[PATCH][next] drm/nouveau: outp: Use __member_size() helper

2025-04-22 Thread Gustavo A. R. Silva
Use __member_size() to get the size of the flex-array member at compile time, instead of the convoluted expression `__struct_size(p) - sizeof(*p)` Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm/nouveau/nvif/outp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a

[PATCH][next] drm/nouveau: disp: Use __member_size() helper

2025-04-22 Thread Gustavo A. R. Silva
Use __member_size() to get the size of the flex-array member at compile time, instead of the convoluted expression `__struct_size(p) - sizeof(*p)` Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm/nouveau/dispnv50/disp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a

Re: [PATCH][next] drm/amd/pm: Avoid multiple -Wflex-array-member-not-at-end warnings

2025-04-22 Thread Gustavo A. R. Silva
On 16/04/25 09:04, Alex Deucher wrote: Can you resend, I can't seem to find the original emails. Additionally, all of the NISLANDS structures are unused in amdgpu, so those could be removed. Okay, I'll take a look. Thanks -Gustavo

[PATCH v2][next] drm/nouveau: chan: Avoid -Wflex-array-member-not-at-end warnings

2025-04-16 Thread Gustavo A. R. Silva
] Signed-off-by: Gustavo A. R. Silva --- Changes in v2: - Use __member_size() instead of __struct_size() to get the compile-time size of the flexible array. v1: - Link: https://lore.kernel.org/linux-hardening/Z-67Hm9uHEJs0RGw@kspp/ drivers/gpu/drm/nouveau/nouveau_chan.c | 114

Re: [PATCH][next] drm/amd/pm: Avoid multiple -Wflex-array-member-not-at-end warnings

2025-04-15 Thread Gustavo A. R. Silva
Hi all, Friendly ping (second one): who can take this patch, please? 🙂 Thanks! -Gustavo On 11/03/25 02:10, Gustavo A. R. Silva wrote: Hi all, Friendly ping: who can take this, please? :) Thanks! -- Gustavo On 14/02/25 18:48, Gustavo A. R. Silva wrote: -Wflex-array-member-not-at-end was

Re: [PATCH][next] drm/nouveau: chan: Avoid -Wflex-array-member-not-at-end warnings

2025-04-11 Thread Gustavo A. R. Silva
On 08/04/25 17:40, Kees Cook wrote: On Mon, Apr 07, 2025 at 05:35:47PM -0600, Gustavo A. R. Silva wrote: [..] - struct { - struct nvif_chan_v0 chan; - char name[TASK_COMM_LEN+16]; - } args; + DEFINE_RAW_FLEX(struct nvif_chan_v0, args, name

Re: [PATCH][next] drm/nouveau: chan: Avoid -Wflex-array-member-not-at-end warnings

2025-04-10 Thread Gustavo A. R. Silva
On 07/04/25 13:50, Kees Cook wrote: On Thu, Apr 03, 2025 at 10:45:18AM -0600, Gustavo A. R. Silva wrote: -Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally. Use the `DEFINE_RAW_FLEX()` helper for a few on-stack definitions of a flexible

Re: [PATCH][next] drm/nouveau: chan: Avoid -Wflex-array-member-not-at-end warnings

2025-04-07 Thread Gustavo A. R. Silva
[..] - struct { - struct nvif_chan_v0 chan; - char name[TASK_COMM_LEN+16]; - } args; + DEFINE_RAW_FLEX(struct nvif_chan_v0, args, name, TASK_COMM_LEN + 16); struct nvif_device *device = &cli->device; struct nouveau_channel *chan;

[PATCH v2][next] drm/nouveau: disp: Avoid -Wflex-array-member-not-at-end warning

2025-04-05 Thread Gustavo A. R. Silva
, accordingly. So, with these changes, fix the following warning: drivers/gpu/drm/nouveau/dispnv50/disp.c:779:47: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] Signed-off-by: Gustavo A. R. Silva --- Changes in v2

[PATCH v2][next] drm/nouveau: fifo: Avoid -Wflex-array-member-not-at-end warning

2025-04-04 Thread Gustavo A. R. Silva
/nouveau/nvif/fifo.c:29:42: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] Signed-off-by: Gustavo A. R. Silva --- Changes in v2: - Adjust heap allocation instead of using the DEFINE_RAW_FLEX() helper. - Link: https

Re: [PATCH][next] drm/nouveau: fifo: Avoid -Wflex-array-member-not-at-end warning

2025-04-04 Thread Gustavo A. R. Silva
On 03/04/25 11:41, Gustavo A. R. Silva wrote: -Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally. Use the `DEFINE_RAW_FLEX()` helper for an on-stack definition of a flexible structure where the size of the flexible-array member is known

[PATCH][next] drm/nouveau: fifo: Avoid -Wflex-array-member-not-at-end warning

2025-04-03 Thread Gustavo A. R. Silva
, accordingly. So, with these changes, fix the following warning: drivers/gpu/drm/nouveau/nvif/fifo.c:29:42: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm

Re: [PATCH v2][next] drm/nouveau: disp: Avoid -Wflex-array-member-not-at-end warning

2025-04-03 Thread Gustavo A. R. Silva
Applied this one (as well as the svm and fence one) to drm-misc-next, thanks! Awesome. :) Thanks! -- Gustavo

[PATCH][next] drm/nouveau: chan: Avoid -Wflex-array-member-not-at-end warnings

2025-04-03 Thread Gustavo A. R. Silva
] Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm/nouveau/nouveau_chan.c | 115 - 1 file changed, 56 insertions(+), 59 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_chan.c b/drivers/gpu/drm/nouveau/nouveau_chan.c index cd659b9fd1d9..a7e70517b7cd 100644 --- a

[PATCH][next] drm/nouveau: svm: Avoid -Wflex-array-member-not-at-end warning

2025-04-02 Thread Gustavo A. R. Silva
, accordingly. So, with these changes, fix the following warning: drivers/gpu/drm/nouveau/nouveau_svm.c:724:44: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm

[PATCH][next] drm/nouveau: fence: Avoid -Wflex-array-member-not-at-end warning

2025-04-02 Thread Gustavo A. R. Silva
, accordingly. So, with these changes, fix the following warning: drivers/gpu/drm/nouveau/nouveau_fence.c:188:38: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm

[PATCH v2][next] drm/nouveau/outp: Avoid -Wflex-array-member-not-at-end warning

2025-03-28 Thread Gustavo A. R. Silva
, accordingly. So, with these changes, fix the following warning: drivers/gpu/drm/nouveau/nvif/outp.c:199:45: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] Signed-off-by: Gustavo A. R. Silva --- Changes in v2

Re: [PATCH][next] drm/nouveau/outp: Avoid -Wflex-array-member-not-at-end warning

2025-03-28 Thread Gustavo A. R. Silva
On 28/03/25 09:05, Danilo Krummrich wrote: On Fri, Mar 28, 2025 at 08:45:32AM -0600, Gustavo A. R. Silva wrote: -Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally. Use the `DEFINE_RAW_FLEX()` helper for an on-stack definition of a

[PATCH][next] drm/nouveau/conn: Avoid -Wflex-array-member-not-at-end warning

2025-03-28 Thread Gustavo A. R. Silva
, accordingly. So, with these changes, fix the following warning: drivers/gpu/drm/nouveau/nvif/conn.c:34:38: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm

[PATCH][next] drm/nouveau/outp: Avoid -Wflex-array-member-not-at-end warning

2025-03-28 Thread Gustavo A. R. Silva
, accordingly. So, with these changes, fix the following warning: drivers/gpu/drm/nouveau/nvif/outp.c:199:45: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm

Re: [PATCH][next] drm/amd/pm: Avoid multiple -Wflex-array-member-not-at-end warnings

2025-03-11 Thread Gustavo A. R. Silva
Hi all, Friendly ping: who can take this, please? :) Thanks! -- Gustavo On 14/02/25 18:48, Gustavo A. R. Silva wrote: -Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally. So, in order to avoid ending up with a flexible-array member in the

Re: [PATCH][next] drm/nouveau: Avoid multiple -Wflex-array-member-not-at-end warnings

2025-02-27 Thread Gustavo A. R. Silva
> Applied to drm-misc-next, thanks! Awesome. :) Thank you, guys. -- Gustavo

[PATCH][next] drm/amd/pm: Avoid multiple -Wflex-array-member-not-at-end warnings

2025-02-14 Thread Gustavo A. R. Silva
of another structure [-Wflex-array-member-not-at-end] drivers/gpu/drm/amd/amdgpu/../pm/legacy-dpm/si_dpm.h:816:41: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm

[PATCH][next] drm/nouveau: Avoid multiple -Wflex-array-member-not-at-end warnings

2025-02-12 Thread Gustavo A. R. Silva
] drivers/gpu/drm/nouveau/nouveau_svm.c:82:30: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm/nouveau/include/nvif/ioctl.h | 32 +--- drivers/gpu/drm

Re: [PATCH][next] drm/nouveau: Avoid -Wflex-array-member-not-at-end warning

2024-10-03 Thread Gustavo A. R. Silva
Yes, it's not great, but I think it's better than having the length in two places. Agreed. I'll respin. :) Thanks -- Gustavo

Re: [PATCH][next] drm/nouveau: Avoid -Wflex-array-member-not-at-end warning

2024-10-03 Thread Gustavo A. R. Silva
On 03/10/24 12:36, Danilo Krummrich wrote: On 9/13/24 12:23 PM, Danilo Krummrich wrote: Hi, On 9/13/24 10:09 AM, Gustavo A. R. Silva wrote: Hi all, Friendly ping: who can take this, please? 🙂 Usually, that's me. But I thought you might want to send a v2 based on Kees' comm

Re: [PATCH][next] drm/nouveau: Avoid -Wflex-array-member-not-at-end warning

2024-09-13 Thread Gustavo A. R. Silva
Hi all, Friendly ping: who can take this, please? 🙂 Thanks -Gustavo On 21/08/24 22:16, Gustavo A. R. Silva wrote: Use the `DEFINE_RAW_FLEX()` helper for an on-stack definition of a flexible structure where the size of the flexible-array member is known at compile-time, and refactor the rest

Re: [PATCH][next] drm/nouveau: Avoid -Wflex-array-member-not-at-end warning

2024-08-27 Thread Gustavo A. R. Silva
On 22/08/24 11:27, Kees Cook wrote: On Wed, Aug 21, 2024 at 02:16:21PM -0600, Gustavo A. R. Silva wrote: Use the `DEFINE_RAW_FLEX()` helper for an on-stack definition of a flexible structure where the size of the flexible-array member is known at compile-time, and refactor the rest of the

[PATCH][next] drm/nouveau: Avoid -Wflex-array-member-not-at-end warning

2024-08-21 Thread Gustavo A. R. Silva
: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm/nouveau/dispnv50/disp.c | 20 +--- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a

Re: [PATCH v2] udmabuf: Fix a potential (and unlikely) access to unallocated memory

2024-02-19 Thread Gustavo A. R. Silva
which checks for overflow. While at it, include . Fixes: fbb0de795078 ("Add udmabuf misc device")' I don't think this tag is needed in this case. Also, please, CC linux-hardening next time. Signed-off-by: Christophe JAILLET In any case, LGTM: Reviewed-by: Gustavo A. R.

Re: [PATCH] drm/xe: Prefer struct_size over open coded arithmetic

2024-02-10 Thread Gustavo A. R. Silva
ttps://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments [1] Link: https://github.com/KSPP/linux/issues/160 [2] Signed-off-by: Erick Archer LGTM: Reviewed-by: Gustavo A. R. Silva Thanks! -- Gustavo --- drivers/gpu/drm/xe/xe_exec_queue.c | 2 +-

Re: [PATCH] drm/i915: Add flex arrays to struct i915_syncmap

2024-02-08 Thread Gustavo A. R. Silva
deprecated.html#zero-length-and-one-element-arrays [1] Link: https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments [2] Signed-off-by: Erick Archer Nice transformation! LGTM: Reviewed-by: Gustavo A. R. Silva Thanks -- Gustavo --- drivers/g

Re: [GIT PULL] Enable -Wstringop-overflow globally

2024-01-27 Thread Gustavo A. R. Silva
On 1/27/24 09:11, David Laight wrote: From: Linus Torvalds Sent: 26 January 2024 22:36 On Fri, 26 Jan 2024 at 14:24, Kees Cook wrote: I think xe has some other weird problems too. This may be related (under allocating): ../drivers/gpu/drm/xe/xe_vm.c: In function 'xe_vma_create': ../drive

Re: [PATCH] accel/habanalabs: use kcalloc() instead of kzalloc()

2024-01-22 Thread Gustavo A. R. Silva
ze * count in the kzalloc() function. Link: https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments [1] Link: https://github.com/KSPP/linux/issues/162 Signed-off-by: Erick Archer Reviewed-by: Gustavo A. R. Silva Thanks! -- Gustavo --- dri

Re: [Nouveau] [PATCH][next] nouveau/gsp: replace zero-length array with flex-array member and use __counted_by

2023-11-28 Thread Gustavo A. R. Silva
On 11/28/23 19:01, Danilo Krummrich wrote: On 11/16/23 20:55, Timur Tabi wrote: On Thu, 2023-11-16 at 20:45 +0100, Danilo Krummrich wrote: As I already mentioned for Timur's patch [2], I'd prefer to get a fix upstream (meaning [1] in this case). Of course, that's probably more up to Timur to

[PATCH][next] nouveau/gsp: replace zero-length array with flex-array member and use __counted_by

2023-11-16 Thread Gustavo A. R. Silva
subscript 0 is outside array bounds of 'PACKED_REGISTRY_ENTRY[0]' [-Warray-bounds=] While there, also make use of the struct_size() helper, and address checkpatch.pl warning: WARNING: please, no spaces at the start of a line This results in no differences in binary output. Signed-of

Re: [PATCH][next] dma-buf: Fix NULL pointer dereference in dma_fence_enable_sw_signaling()

2023-10-11 Thread Gustavo A. R. Silva
On 10/11/23 10:03, Kees Cook wrote: On Wed, Oct 11, 2023 at 08:03:43AM -0600, Gustavo A. R. Silva wrote: Currently, a NULL pointer dereference will happen in function `dma_fence_enable_sw_signaling()` (at line 615), in case `chain` is not allocated in `mock_chain()` and this function returns

[PATCH][next] dma-buf: Fix NULL pointer dereference in dma_fence_enable_sw_signaling()

2023-10-11 Thread Gustavo A. R. Silva
"dma-buf: Enable signaling on fence for selftests") Cc: sta...@vger.kernel.org Signed-off-by: Gustavo A. R. Silva --- drivers/dma-buf/dma-fence.c | 9 - include/linux/dma-fence.h | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/dma-buf/dma-fence.c b/d

Re: [PATCH] drm/i915/guc: Annotate struct ct_incoming_msg with __counted_by

2023-10-06 Thread Gustavo A. R. Silva
(for strcpy/memcpy-family functions). As found with Coccinelle[1], add __counted_by for struct ct_incoming_msg. Cc: Jani Nikula Cc: Joonas Lahtinen Cc: Rodrigo Vivi Cc: Tvrtko Ursulin Cc: David Airlie Cc: Daniel Vetter Cc: "Gustavo A. R. Silva" Cc: John Harrison Cc: Matthew

Re: [PATCH 5/9] drm/nouveau/pm: Annotate struct nvkm_perfdom with __counted_by

2023-09-24 Thread Gustavo A. R. Silva
Cc: dri-devel@lists.freedesktop.org Cc: nouv...@lists.freedesktop.org Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva Thanks -- Gustavo --- drivers/gpu/drm/nouveau/nvkm/engine/pm/priv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau

Re: [PATCH 7/9] drm/virtio: Annotate struct virtio_gpu_object_array with __counted_by

2023-09-23 Thread Gustavo A. R. Silva
: Daniel Vetter Cc: dri-devel@lists.freedesktop.org Cc: virtualizat...@lists.linux-foundation.org Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva Thanks -- Gustavo --- drivers/gpu/drm/virtio/virtgpu_drv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers

Re: [PATCH] video: mmp: Annotate struct mmp_path with __counted_by

2023-09-23 Thread Gustavo A. R. Silva
-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva Thanks -- Gustavo --- include/video/mmp_disp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/video/mmp_disp.h b/include/video/mmp_disp.h index 77252cb46361..a722dcbf5073 100644 --- a/include/video/mmp_disp.h

Re: [PATCH] video: fbdev: mmp: Annotate struct mmphw_ctrl with __counted_by

2023-09-23 Thread Gustavo A. R. Silva
Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva Thanks -- Gustavo --- drivers/video/fbdev/mmp/hw/mmp_ctrl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/mmp/hw/mmp_ctrl.h b/drivers/video/fbdev/mmp/hw/mmp_ctrl.h index 167585a889d3

Re: [PATCH 1/9] drm/amd/pm: Annotate struct smu10_voltage_dependency_table with __counted_by

2023-09-23 Thread Gustavo A. R. Silva
Cc: "Pan, Xinhui" Cc: David Airlie Cc: Daniel Vetter Cc: Xiaojian Du Cc: Huang Rui Cc: Kevin Wang Cc: amd-...@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva Thanks -- Gustavo --- drivers/gpu/drm/am

Re: [PATCH 6/9] drm/vc4: Annotate struct vc4_perfmon with __counted_by

2023-09-22 Thread Gustavo A. R. Silva
@lists.freedesktop.org Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva Thanks -- Gustavo --- drivers/gpu/drm/vc4/vc4_drv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h index bf66499765fb

Re: [PATCH 4/9] drm/msm/dpu: Annotate struct dpu_hw_intr with __counted_by

2023-09-22 Thread Gustavo A. R. Silva
Cc: David Airlie Cc: Daniel Vetter Cc: Bjorn Andersson Cc: linux-arm-...@vger.kernel.org Cc: dri-devel@lists.freedesktop.org Cc: freedr...@lists.freedesktop.org Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva Thanks -- Gustavo --- drivers/gpu/drm/msm/disp/dpu1

Re: [PATCH 3/9] drm/i915/selftests: Annotate struct perf_series with __counted_by

2023-09-22 Thread Gustavo A. R. Silva
Airlie Cc: Daniel Vetter Cc: Chris Wilson Cc: John Harrison Cc: Andi Shyti Cc: Matthew Brost Cc: intel-...@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva Thanks -- Gustavo --- drivers/gpu/drm/i915/selftests

Re: [PATCH 2/9] drm/amdgpu/discovery: Annotate struct ip_hw_instance with __counted_by

2023-09-22 Thread Gustavo A. R. Silva
Cc: David Airlie Cc: Daniel Vetter Cc: Hawking Zhang Cc: amd-...@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva Thanks -- Gustavo --- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +- 1 file changed, 1 insertion(+),

Re: [PATCH] udmabuf: Fix a potential (and unlikely) access to unallocated memory

2023-09-18 Thread Gustavo A. R. Silva
On 9/18/23 12:46, Christophe JAILLET wrote: If 'list_limit' is set to a very high value, 'lsize' computation could overflow if 'head.count' is big enough. In such a case, udmabuf_create() will access to memory beyond 'list'. Use size_mul() to saturate the value, and have memdup_user() fail.

Re: [PATCH][next] drm/gud: Use size_add() in call to struct_size()

2023-09-15 Thread Gustavo A. R. Silva
On 9/15/23 12:52, Kees Cook wrote: On Fri, Sep 15, 2023 at 12:43:20PM -0600, Gustavo A. R. Silva wrote: If, for any reason, the open-coded arithmetic causes a wraparound, the protection that `struct_size()` adds against potential integer overflows is defeated. Fix this by hardening call to

[PATCH][next] drm/gud: Use size_add() in call to struct_size()

2023-09-15 Thread Gustavo A. R. Silva
ned-off-by: Gustavo A. R. Silva --- drivers/gpu/drm/gud/gud_pipe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/gud/gud_pipe.c b/drivers/gpu/drm/gud/gud_pipe.c index d2f199ea3c11..a02f75be81f0 100644 --- a/drivers/gpu/drm/gud/gud_pipe.c +++ b/drivers/gpu/drm/gud/

Re: [PATCH] clk: Annotate struct clk_hw_onecell_data with __counted_by

2023-08-17 Thread Gustavo A. R. Silva
...@lists.infradead.org Cc: linux-asp...@lists.ozlabs.org Cc: linux-arm-...@vger.kernel.org Cc: linux-media...@lists.infradead.org Cc: dri-devel@lists.freedesktop.org Cc: linux-su...@lists.linux.dev Cc: linux-...@lists.infradead.org Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva Thanks

[PATCH 2/2][next] nouveau/svm: Split assignment from if conditional

2023-08-16 Thread Gustavo A. R. Silva
Fix checkpatch.pl ERROR: do not use assignment in if condition. Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm/nouveau/nouveau_svm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_svm.c b/drivers/gpu/drm/nouveau/nouveau_svm.c index

[PATCH 1/2][next] nouveau/svm: Replace one-element array with flexible-array member in struct nouveau_svm

2023-08-16 Thread Gustavo A. R. Silva
One-element and zero-length arrays are deprecated. So, replace one-element array in struct nouveau_svm with flexible-array member. This results in no differences in binary output. Link: https://github.com/KSPP/linux/issues/338 Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm/nouveau

[PATCH 0/2][next] nouveau/svm: Replace one-element array with flexible-array member

2023-08-16 Thread Gustavo A. R. Silva
This small series aims to replace a one-element array with a flexible-array member in struct nouveau_svm. And, while at it, fix a checkpatch.pl error. Gustavo A. R. Silva (2): nouveau/svm: Replace one-element array with flexible-array member in struct nouveau_svm nouveau/svm: Split

[PATCH][next] fbdev: sh7760fb: Fix -Wimplicit-fallthrough warnings

2023-06-22 Thread Gustavo A. R. Silva
gh=] 143 | lgray = 1; | ~~^~~ drivers/video/fbdev/sh7760fb.c:144:9: note: here 144 | case LDDFR_8BPP: | ^~~~ Signed-off-by: Gustavo A. R. Silva --- drivers/video/fbdev/sh7760fb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/v

[PATCH][next] drm/amdgpu/discovery: Replace fake flex-arrays with flexible-array members

2023-05-28 Thread Gustavo A. R. Silva
/602902.html [1] Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm/amd/include/discovery.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/include/discovery.h b/drivers/gpu/drm/amd/include/discovery.h index 9181e57887db..f43e29722ef7 100644 --- a

Re: [PATCH][next] drm/i915/uapi: Replace fake flex-array with flexible-array member

2023-04-06 Thread Gustavo A. R. Silva
On 3/31/23 01:02, Jani Nikula wrote: On Thu, 30 Mar 2023, "Gustavo A. R. Silva" wrote: Friendly ping: who can take this, please? 😄 It's in drm-intel-gt-next. Awesome. :) Thank you! -- Gustavo commit 02abecdeebfcd3848b26b70778dd7f6eb0db65e1 Author: Gust

Re: [PATCH][next] drm/i915/uapi: Replace fake flex-array with flexible-array member

2023-03-30 Thread Gustavo A. R. Silva
Hi all, Friendly ping: who can take this, please? 😄 Thanks -- Gustavo On 3/17/23 12:18, Gustavo A. R. Silva wrote: Zero-length arrays as fake flexible arrays are deprecated and we are moving towards adopting C99 flexible-array members instead. Address the following warning found with GCC-13

Re: [PATCH] drm/nouveau/disp: More DP_RECEIVER_CAP_SIZE array fixes

2023-03-22 Thread Gustavo A. R. Silva
ire_dp(struct nvif_outp *outp, u8 dpcd[DP_RECEIVER_CAP_SIZE], | ~~~^~ Fixes: 813443721331 ("drm/nouveau/disp: move DP link config into acquire") Cc: Ben Skeggs Cc: Lyude Paul Cc: Karol Herbst Cc: David Air

[PATCH][next] drm/i915/uapi: Replace fake flex-array with flexible-array member

2023-03-17 Thread Gustavo A. R. Silva
ly enabling -fstrict-flex-arrays=3 [1]. Link: https://github.com/KSPP/linux/issues/21 Link: https://github.com/KSPP/linux/issues/271 Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1] Signed-off-by: Gustavo A. R. Silva --- include/uapi/drm/i915_drm.h | 2 +- 1 file changed,

[PATCH][next] drm/vmwgfx: Replace one-element array with flexible-array member

2023-02-02 Thread Gustavo A. R. Silva
globally enabling -fstrict-flex-arrays=3 [1]. This results in no differences in binary output. Link: https://github.com/KSPP/linux/issues/79 Link: https://github.com/KSPP/linux/issues/254 Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [1] Signed-off-by: Gustavo A. R. Silva

Re: [PATCH][next] drm/i915/guc: Replace zero-length arrays with flexible-array members

2023-01-10 Thread Gustavo A. R. Silva
On Tue, Jan 10, 2023 at 02:28:11PM -0500, Rodrigo Vivi wrote: > > On Tue, Jan 10, 2023 at 10:44:53AM -0600, Gustavo A. R. Silva wrote: > > Zero-length arrays are deprecated[1] and we are moving towards > > adopting C99 flexible-array members, instead. So, replace zero-leng

[PATCH][next] drm/i915/guc: Replace zero-length arrays with flexible-array members

2023-01-10 Thread Gustavo A. R. Silva
/linux/issues/78 Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm/i915/gt/uc/guc_capture_fwif.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/uc/guc_capture_fwif.h b/drivers/gpu/drm/i915/gt/uc/guc_capture_fwif.h index 3624abfd22d1

[PATCH][next] habanalabs: Replace zero-length arrays with flexible-array members

2023-01-09 Thread Gustavo A. R. Silva
-off-by: Gustavo A. R. Silva --- drivers/accel/habanalabs/include/gaudi2/gaudi2_packets.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/accel/habanalabs/include/gaudi2/gaudi2_packets.h b/drivers/accel/habanalabs/include/gaudi2/gaudi2_packets.h index 8bf90fc18bf5

[PATCH][next] drm/nouveau/nvkm: Replace zero-length array with flexible-array member

2023-01-09 Thread Gustavo A. R. Silva
/issues/78 Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm/nouveau/include/nvfw/hs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/include/nvfw/hs.h b/drivers/gpu/drm/nouveau/include/nvfw/hs.h index 8c4cd08a7b5f..8b58b668fc0c 100644 --- a

Re: [PATCH] fbdev: Replace 0-length array with flexible array

2023-01-06 Thread Gustavo A. R. Silva
ps://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays > > Cc: Helge Deller > Cc: "Gustavo A. R. Silva" > Cc: linux-fb...@vger.kernel.org > Cc: dri-devel@lists.freedesktop.org > Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R.

Re: [RESEND][PATCH] drm/nouveau/fb/ga102: Replace zero-length array of trailing structs with flex-array

2023-01-03 Thread Gustavo A. R. Silva
ude Paul > Cc: David Airlie > Cc: Daniel Vetter > Cc: Gourav Samaiya > Cc: "Gustavo A. R. Silva" > Cc: dri-devel@lists.freedesktop.org > Cc: nouv...@lists.freedesktop.org > Signed-off-by: Kees Cook Here is my RB again: Reviewed-by: Gustavo A. R. Silva T

Re: [PATCH] drm/nouveau/fb/ga102: Replace zero-length array of trailing structs with flex-array

2022-11-18 Thread Gustavo A. R. Silva
ude Paul > Cc: David Airlie > Cc: Daniel Vetter > Cc: Gourav Samaiya > Cc: "Gustavo A. R. Silva" > Cc: dri-devel@lists.freedesktop.org > Cc: nouv...@lists.freedesktop.org > Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva Thanks! -- Gustavo >

Re: [RFC] Approaches to deal with a struct with multiple fake flexible arrays members

2022-11-10 Thread Gustavo A. R. Silva
On Wed, Nov 09, 2022 at 10:20:34PM -0500, Alex Deucher wrote: > On Wed, Nov 9, 2022 at 8:31 PM Paulo Miguel Almeida > wrote: > > > > On Wed, Nov 09, 2022 at 06:45:57PM -0600, Gustavo A. R. Silva wrote: > > > On Wed, Nov 09, 2022 at 04:45:42PM +1300, Paulo Miguel Almeid

Re: [RFC] Approaches to deal with a struct with multiple fake flexible arrays members

2022-11-09 Thread Gustavo A. R. Silva
On Wed, Nov 09, 2022 at 04:45:42PM +1300, Paulo Miguel Almeida wrote: Adding Alex, Christian and DRM lists to the thread. > Hi KSPP community, > > I've been working on replacing 1-element arrays with flex array members > on the drm/amdgpu files. I came across one insteresting case which I > may

Re: [PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members

2022-06-28 Thread Gustavo A. R. Silva
On Mon, Jun 27, 2022 at 12:53:43PM -0700, Stephen Hemminger wrote: > Thanks this fixes warning with gcc-12 in iproute2. > In function ‘xfrm_algo_parse’, > inlined from ‘xfrm_state_modify.constprop’ at xfrm_state.c:573:5: > xfrm_state.c:162:32: warning: writing 1 byte into a region of size 0 >

Re: [PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members

2022-06-28 Thread Gustavo A. R. Silva
On Tue, Jun 28, 2022 at 10:36:51AM -0300, Jason Gunthorpe wrote: > On Tue, Jun 28, 2022 at 04:21:29AM +0200, Gustavo A. R. Silva wrote: > > > > > Though maybe we could just switch off > > > > -Wgnu-variable-sized-type-not-at-end during configuration ? > &g

Re: [PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members

2022-06-27 Thread Gustavo A. R. Silva
On Tue, Jun 28, 2022 at 02:58:25AM +0200, Gustavo A. R. Silva wrote: > On Mon, Jun 27, 2022 at 09:40:52PM -0300, Jason Gunthorpe wrote: > > On Mon, Jun 27, 2022 at 08:27:37PM +0200, Daniel Borkmann wrote: > > > On 6/27/22 8:04 PM, Gustavo A. R. Silva wrote: > > > >

Re: [PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members

2022-06-27 Thread Gustavo A. R. Silva
On Mon, Jun 27, 2022 at 09:40:52PM -0300, Jason Gunthorpe wrote: > On Mon, Jun 27, 2022 at 08:27:37PM +0200, Daniel Borkmann wrote: > > On 6/27/22 8:04 PM, Gustavo A. R. Silva wrote: > > > There is a regular need in the kernel to provide a way to declare > > > having

Re: [PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members

2022-06-27 Thread Gustavo A. R. Silva
On Mon, Jun 27, 2022 at 08:27:37PM +0200, Daniel Borkmann wrote: > On 6/27/22 8:04 PM, Gustavo A. R. Silva wrote: > > There is a regular need in the kernel to provide a way to declare > > having a dynamically sized set of trailing elements in a structure. > > Kernel c

[PATCH][next] treewide: uapi: Replace zero-length arrays with flexible-array members

2022-06-27 Thread Gustavo A. R. Silva
ocess/deprecated.html#zero-length-and-one-element-arrays Link: https://github.com/KSPP/linux/issues/78 Build-tested-by: https://lore.kernel.org/lkml/62b675ec.wkx6aoz6cbe71vtf%25...@intel.com/ Signed-off-by: Gustavo A. R. Silva --- Hi all! JFYI: I'm adding this to my -next tree. :) arch/m

[PATCH][next] drm/i915: Fix -Wstringop-overflow warning in call to intel_read_wm_latency()

2022-04-27 Thread Gustavo A. R. Silva
cks for that. This helps with the ongoing efforts to globally enable -Wstringop-overflow. Link: https://github.com/KSPP/linux/issues/181 Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm/i915/intel_pm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i

Re: [PATCH][next] drm/amd/display: Fix Wstringop-overflow warnings in dc_link_dp.c

2022-03-03 Thread Gustavo A. R. Silva
On Thu, Mar 03, 2022 at 12:19:57PM -0600, Gustavo A. R. Silva wrote: > On Thu, Mar 03, 2022 at 09:43:28AM -0800, Kees Cook wrote: > > On Thu, Mar 03, 2022 at 11:25:03AM -0600, Gustavo A. R. Silva wrote: > > > Fix the following Wstringop-overflow warnings when bu

Re: [PATCH][next] drm/amd/display: Fix Wstringop-overflow warnings in dc_link_dp.c

2022-03-03 Thread Gustavo A. R. Silva
On Thu, Mar 03, 2022 at 09:43:28AM -0800, Kees Cook wrote: > On Thu, Mar 03, 2022 at 11:25:03AM -0600, Gustavo A. R. Silva wrote: > > Fix the following Wstringop-overflow warnings when building with GCC-11: > > > > drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_link_dpia.c

[PATCH][next] drm/amd/display: Fix Wstringop-overflow warnings in dc_link_dp.c

2022-03-03 Thread Gustavo A. R. Silva
-off-by: Gustavo A. R. Silva --- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 4 ++-- drivers/gpu/drm/amd/display/dc/inc/dc_link_dp.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c b/drivers/gpu/drm/amd/display/dc

Re: [PATCH][next] treewide: Replace zero-length arrays with flexible-array members

2022-02-16 Thread Gustavo A. R. Silva
On Wed, Feb 16, 2022 at 08:05:47PM +0100, Rafael J. Wysocki wrote: > On Tue, Feb 15, 2022 at 8:24 PM Gustavo A. R. Silva > wrote: > > Can you also send the ACPI patch separately, please? > > We would like to route it through the upstream ACPICA code base. Yeah; no problem. Thanks -- Gustavo

Re: [PATCH][next] treewide: Replace zero-length arrays with flexible-array members

2022-02-15 Thread Gustavo A. R. Silva
On Tue, Feb 15, 2022 at 09:19:29PM +0200, Leon Romanovsky wrote: > On Tue, Feb 15, 2022 at 01:21:10PM -0600, Gustavo A. R. Silva wrote: > > On Tue, Feb 15, 2022 at 10:17:40AM -0800, Kees Cook wrote: > > > On Tue, Feb 15, 2022 at 11:47:43AM -0600, Gustavo A. R. Silva wrote: >

Re: [PATCH][next] treewide: Replace zero-length arrays with flexible-array members

2022-02-15 Thread Gustavo A. R. Silva
On Tue, Feb 15, 2022 at 10:17:40AM -0800, Kees Cook wrote: > On Tue, Feb 15, 2022 at 11:47:43AM -0600, Gustavo A. R. Silva wrote: > > There is a regular need in the kernel to provide a way to declare > > having a dynamically sized set of trailing elements in a structure. > &g

[PATCH][next] treewide: Replace zero-length arrays with flexible-array members

2022-02-15 Thread Gustavo A. R. Silva
off-by: Gustavo A. R. Silva --- Hi all, I'm expecting to carry this patch in my tree, so it'd be great to get some Acks. And given the size of the patch, I'm only sending this to mailing lists. Thanks! arch/alpha/include/asm/hwrpb.h| 2 +- arch/ia64

[PATCH][next] nouveau/svm: Use struct_size() helper in nouveau_pfns_map()

2022-02-07 Thread Gustavo A. R. Silva
Make use of the struct_size() helper instead of an open-coded version, in order to avoid any potential type mistakes or integer overflows that, in the worse scenario, could lead to heap overflows. Link: https://github.com/KSPP/linux/issues/160 Signed-off-by: Gustavo A. R. Silva --- drivers/gpu

[PATCH][next] drm/i915/guc: Use struct_size() helper in kmalloc()

2022-01-25 Thread Gustavo A. R. Silva
: warning: using sizeof on a flexible structure Link: https://github.com/KSPP/linux/issues/174 Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_ct.c b/drivers/gpu

Re: [PATCH] drm/dp: Remove common Post Cursor2 register handling

2022-01-18 Thread Gustavo A. R. Silva
ursor adjustments") This should be tagged for -stable: Cc: sta...@vger.kernel.org > Cc: Maarten Lankhorst > Cc: Maxime Ripard > Cc: Thomas Zimmermann > Cc: David Airlie > Cc: Daniel Vetter > Cc: dri-devel@lists.freedesktop.org > Signed-off-by: Kees Cook Reviewed-by

Re: [PATCH] drm/dp: Fix off-by-one in register cache size

2021-12-13 Thread Gustavo A. R. Silva
Lankhorst > Cc: Maxime Ripard > Cc: Thomas Zimmermann > Cc: David Airlie > Cc: Daniel Vetter > Cc: dri-devel@lists.freedesktop.org > Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva Thanks -- Gustavo > --- > include/drm/drm_dp_helper.h | 2 +- > 1 file changed,

Re: [PATCH] fbdev: sh7760fb: document fallthrough cases

2021-11-15 Thread Gustavo A. R. Silva
On Mon, Nov 15, 2021 at 09:35:09AM +0100, Geert Uytterhoeven wrote: > On Mon, Nov 15, 2021 at 7:33 AM Randy Dunlap wrote: > > Fix fallthrough warnings in sh776fb.c: > > > > ../drivers/video/fbdev/sh7760fb.c: In function 'sh7760fb_get_color_info': > > ../drivers/video/fbdev/sh7760fb.c:138:23: warni

Re: [PATCH] fbdev: sh7760fb: document fallthrough cases

2021-11-14 Thread Gustavo A. R. Silva
gt; Fixes: 4a25e41831ee ("video: sh7760fb: SH7760/SH7763 LCDC framebuffer driver") > Signed-off-by: Randy Dunlap > Cc: "Gustavo A. R. Silva" > Cc: Nobuhiro Iwamatsu > Cc: Manuel Lauss > Cc: Yoshinori Sato > Cc: Rich Felker > Cc: linux...@vger.kerne

Re: [PATCH][next] nouveau/svm: Use kvcalloc() instead of kvzalloc()

2021-10-28 Thread Gustavo A. R. Silva
that kvcalloc checks whether the multiplication overflows and > > returns NULL in this case? > > That's correct. :) > > > On Wed, Sep 29, 2021 at 12:21 AM Gustavo A. R. Silva > > wrote: > > > > > > Use 2-factor argument form kvcalloc() instead of

Re: [PATCH] video: omapfb: Fix fall-through warning for Clang

2021-10-14 Thread Gustavo A. R. Silva
On Thu, Oct 14, 2021 at 08:26:52PM +0200, Sam Ravnborg wrote: > Hi Gustavo, > On Thu, Oct 14, 2021 at 11:53:20AM -0500, Gustavo A. R. Silva wrote: > > Fix the following fallthrough warnings: > > > > drivers/video/fbdev/omap/omapfb_main.c:1558:2: warning: unannotated

[PATCH] video: omapfb: Fix fall-through warning for Clang

2021-10-14 Thread Gustavo A. R. Silva
eported-by: kernel test robot Signed-off-by: Gustavo A. R. Silva --- drivers/video/fbdev/omap/omapfb_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/video/fbdev/omap/omapfb_main.c b/drivers/video/fbdev/omap/omapfb_main.c index 3d090d2d9ed9..b495c09e6102 100644 --- a/drivers/video/

[PATCH][next] nouveau/svm: Use kvcalloc() instead of kvzalloc()

2021-09-28 Thread Gustavo A. R. Silva
Use 2-factor argument form kvcalloc() instead of kvzalloc(). Link: https://github.com/KSPP/linux/issues/162 Signed-off-by: Gustavo A. R. Silva --- drivers/gpu/drm/nouveau/nouveau_svm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_svm.c b

Re: [PATCH 19/64] ip: Use struct_group() for memcpy() regions

2021-07-27 Thread Gustavo A. R. Silva
On 7/28/21 01:31, Gustavo A. R. Silva wrote: > > > On 7/28/21 01:19, Greg Kroah-Hartman wrote: >> On Wed, Jul 28, 2021 at 01:14:33AM -0500, Gustavo A. R. Silva wrote: >>> >>> >>> On 7/28/21 00:55, Greg Kroah-Hartman wrote: >>>> On

Re: [PATCH 19/64] ip: Use struct_group() for memcpy() regions

2021-07-27 Thread Gustavo A. R. Silva
On 7/28/21 01:19, Greg Kroah-Hartman wrote: > On Wed, Jul 28, 2021 at 01:14:33AM -0500, Gustavo A. R. Silva wrote: >> >> >> On 7/28/21 00:55, Greg Kroah-Hartman wrote: >>> On Tue, Jul 27, 2021 at 01:58:10PM -0700, Kees Cook wrote: >>>> In preparation

Re: [PATCH 19/64] ip: Use struct_group() for memcpy() regions

2021-07-27 Thread Gustavo A. R. Silva
On 7/28/21 00:55, Greg Kroah-Hartman wrote: > On Tue, Jul 27, 2021 at 01:58:10PM -0700, Kees Cook wrote: >> In preparation for FORTIFY_SOURCE performing compile-time and run-time >> field bounds checking for memcpy(), memmove(), and memset(), avoid >> intentionally writing across neighboring fie

Re: [PATCH 06/64] bnxt_en: Use struct_group_attr() for memcpy() region

2021-07-27 Thread Gustavo A. R. Silva
le" shows no size nor member offset changes to struct bnxt_cos2bw_cfg. > "objdump -d" shows no meaningful object code changes (i.e. only source > line number induced differences and optimizations). > > Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva Thanks -- G

Re: [PATCH 05/64] skbuff: Switch structure bounds to struct_group()

2021-07-27 Thread Gustavo A. R. Silva
> "objdump -d" shows no no meaningful object code changes (i.e. only source > line number induced differences and optimizations.) > > Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva Thanks -- Gustavo > --- > drivers/net/wireguard/queuein

  1   2   3   4   5   >