drm/nouveau/fb/ga102: Replace zero-length array of trailing structs with flex-array
authorKees Cook <keescook@chromium.org>
Tue, 3 Jan 2023 23:48:36 +0000 (15:48 -0800)
committerKarol Herbst <kherbst@redhat.com>
Mon, 16 Jan 2023 17:18:12 +0000 (18:18 +0100)
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@redhat.com>
Cc: Karol Herbst <kherbst@redhat.com>
Cc: Lyude Paul <lyude@redhat.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Gourav Samaiya <gsamaiya@nvidia.com>
Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: dri-devel@lists.freedesktop.org
Cc: nouveau@lists.freedesktop.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230103234835.never.378-kees@kernel.org
drivers/gpu/drm/nouveau/include/nvfw/hs.h

index 8c4cd08..8b58b66 100644 (file)
@@ -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 *);