* [PATCH][next] drm/nouveau/nvkm: Replace zero-length array with flexible-array member
@ 2023-01-10 1:39 Gustavo A. R. Silva
2023-01-12 22:49 ` Kees Cook
0 siblings, 1 reply; 3+ messages in thread
From: Gustavo A. R. Silva @ 2023-01-10 1:39 UTC (permalink / raw)
To: Ben Skeggs, Karol Herbst, Lyude Paul, David Airlie, Daniel Vetter
Cc: dri-devel, nouveau, linux-kernel, Gustavo A. R. Silva,
linux-hardening
Zero-length arrays are deprecated[1] and we are moving towards
adopting C99 flexible-array members instead. So, replace zero-length
array declaration in struct nvfw_hs_load_header_v2 with flex-array
member.
This helps with the ongoing efforts to tighten the FORTIFY_SOURCE
routines on memcpy() and help us make progress towards globally
enabling -fstrict-flex-arrays=3 [2].
Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays [1]
Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [2]
Link: https://github.com/KSPP/linux/issues/78
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
---
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/drivers/gpu/drm/nouveau/include/nvfw/hs.h
+++ b/drivers/gpu/drm/nouveau/include/nvfw/hs.h
@@ -52,7 +52,7 @@ struct nvfw_hs_load_header_v2 {
struct {
u32 offset;
u32 size;
- } app[0];
+ } app[];
};
const struct nvfw_hs_load_header_v2 *nvfw_hs_load_header_v2(struct nvkm_subdev *, const void *);
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH][next] drm/nouveau/nvkm: Replace zero-length array with flexible-array member
2023-01-10 1:39 [PATCH][next] drm/nouveau/nvkm: Replace zero-length array with flexible-array member Gustavo A. R. Silva
@ 2023-01-12 22:49 ` Kees Cook
2023-01-16 14:41 ` Karol Herbst
0 siblings, 1 reply; 3+ messages in thread
From: Kees Cook @ 2023-01-12 22:49 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Ben Skeggs, Karol Herbst, Lyude Paul, David Airlie, Daniel Vetter,
dri-devel, nouveau, linux-kernel, linux-hardening
On Mon, Jan 09, 2023 at 07:39:30PM -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-length
> array declaration in struct nvfw_hs_load_header_v2 with flex-array
> member.
>
> This helps with the ongoing efforts to tighten the FORTIFY_SOURCE
> routines on memcpy() and help us make progress towards globally
> enabling -fstrict-flex-arrays=3 [2].
>
> Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays [1]
> Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [2]
> Link: https://github.com/KSPP/linux/issues/78
> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
--
Kees Cook
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH][next] drm/nouveau/nvkm: Replace zero-length array with flexible-array member
2023-01-12 22:49 ` Kees Cook
@ 2023-01-16 14:41 ` Karol Herbst
0 siblings, 0 replies; 3+ messages in thread
From: Karol Herbst @ 2023-01-16 14:41 UTC (permalink / raw)
To: Kees Cook
Cc: Gustavo A. R. Silva, Ben Skeggs, Lyude Paul, David Airlie,
Daniel Vetter, dri-devel, nouveau, linux-kernel, linux-hardening
Reviewed-by: Karol Herbst <kherbst@redhat.com>
will push in a moment
On Thu, Jan 12, 2023 at 11:49 PM Kees Cook <keescook@chromium.org> wrote:
>
> On Mon, Jan 09, 2023 at 07:39:30PM -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-length
> > array declaration in struct nvfw_hs_load_header_v2 with flex-array
> > member.
> >
> > This helps with the ongoing efforts to tighten the FORTIFY_SOURCE
> > routines on memcpy() and help us make progress towards globally
> > enabling -fstrict-flex-arrays=3 [2].
> >
> > Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays [1]
> > Link: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/602902.html [2]
> > Link: https://github.com/KSPP/linux/issues/78
> > Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
>
> Reviewed-by: Kees Cook <keescook@chromium.org>
>
> --
> Kees Cook
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-01-16 14:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-10 1:39 [PATCH][next] drm/nouveau/nvkm: Replace zero-length array with flexible-array member Gustavo A. R. Silva
2023-01-12 22:49 ` Kees Cook
2023-01-16 14:41 ` Karol Herbst
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox