Kees Cook
2022-Nov-18 21:12 UTC
[Nouveau] [PATCH] drm/nouveau/fb/ga102: Replace zero-length array of trailing structs with flex-array
Zero-length arrays are deprecated[1] and are being replaced with
flexible array members in support of the ongoing efforts to tighten the
FORTIFY_SOURCE routines on memcpy(), correctly instrument array indexing
with UBSAN_BOUNDS, and to globally enable -fstrict-flex-arrays=3.
Replace zero-length array with flexible-array member.
This results in no differences in binary output.
[1] https://github.com/KSPP/linux/issues/78
Cc: Ben Skeggs <bskeggs at redhat.com>
Cc: Karol Herbst <kherbst at redhat.com>
Cc: Lyude Paul <lyude at redhat.com>
Cc: David Airlie <airlied at gmail.com>
Cc: Daniel Vetter <daniel at ffwll.ch>
Cc: Gourav Samaiya <gsamaiya at nvidia.com>
Cc: "Gustavo A. R. Silva" <gustavoars at kernel.org>
Cc: dri-devel at lists.freedesktop.org
Cc: nouveau at lists.freedesktop.org
Signed-off-by: Kees Cook <keescook at chromium.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
Gustavo A. R. Silva
2022-Nov-18 22:38 UTC
[Nouveau] [PATCH] drm/nouveau/fb/ga102: Replace zero-length array of trailing structs with flex-array
On Fri, Nov 18, 2022 at 01:12:08PM -0800, Kees Cook wrote:> Zero-length arrays are deprecated[1] and are being replaced with > flexible array members in support of the ongoing efforts to tighten the > FORTIFY_SOURCE routines on memcpy(), correctly instrument array indexing > with UBSAN_BOUNDS, and to globally enable -fstrict-flex-arrays=3. > > Replace zero-length array with flexible-array member. > > This results in no differences in binary output. > > [1] https://github.com/KSPP/linux/issues/78 > > Cc: Ben Skeggs <bskeggs at redhat.com> > Cc: Karol Herbst <kherbst at redhat.com> > Cc: Lyude Paul <lyude at redhat.com> > Cc: David Airlie <airlied at gmail.com> > Cc: Daniel Vetter <daniel at ffwll.ch> > Cc: Gourav Samaiya <gsamaiya at nvidia.com> > Cc: "Gustavo A. R. Silva" <gustavoars at kernel.org> > Cc: dri-devel at lists.freedesktop.org > Cc: nouveau at lists.freedesktop.org > Signed-off-by: Kees Cook <keescook at chromium.org>Reviewed-by: Gustavo A. R. Silva <gustavoars at kernel.org> Thanks! -- Gustavo> --- > 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 >