linux-stable/drivers/gpu/drm/nouveau
Gustavo A. R. Silva 52fdb99cc4 nouveau/gsp: replace zero-length array with flex-array member and use __counted_by
Fake flexible arrays (zero-length and one-element arrays) are deprecated,
and should be replaced by flexible-array members. So, replace
zero-length array with a flexible-array member in `struct
PACKED_REGISTRY_TABLE`.

Also annotate array `entries` with `__counted_by()` to prepare for the
coming implementation by GCC and Clang of the `__counted_by` attribute.
Flexible array members annotated with `__counted_by` can have their
accesses bounds-checked at run-time via `CONFIG_UBSAN_BOUNDS` (for array
indexing) and `CONFIG_FORTIFY_SOURCE` (for strcpy/memcpy-family functions).

This fixes multiple -Warray-bounds warnings:
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c:1069:29: warning: array subscript 0 is outside array bounds of 'PACKED_REGISTRY_ENTRY[0]' [-Warray-bounds=]
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c:1070:29: warning: array subscript 0 is outside array bounds of 'PACKED_REGISTRY_ENTRY[0]' [-Warray-bounds=]
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c:1071:29: warning: array subscript 0 is outside array bounds of 'PACKED_REGISTRY_ENTRY[0]' [-Warray-bounds=]
drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c:1072:29: warning: array 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-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Danilo Krummrich <dakr@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/ZVZbX7C5suLMiBf+@work
2023-11-29 03:11:49 +01:00
..
dispnv04 Merge tag 'drm-misc-next-2023-09-27' of git://anongit.freedesktop.org/drm/drm-misc into drm-next 2023-09-29 08:27:15 +10:00
dispnv50 nouveau/disp: fix post-gsp build on 32-bit arm. 2023-10-31 15:11:32 +10:00
include nouveau/gsp: replace zero-length array with flex-array member and use __counted_by 2023-11-29 03:11:49 +01:00
nvif drm/nouveau/disp/r535: initial support 2023-10-31 15:08:16 +10:00
nvkm nouveau/gsp: replace zero-length array with flex-array member and use __counted_by 2023-11-29 03:11:49 +01:00
Kbuild drm/nouveau: implement new VM_BIND uAPI 2023-08-04 20:34:41 +02:00
Kconfig drm/gpuvm: allow building as module 2023-09-26 01:58:28 +02:00
nouveau_abi16.c drm/nouveau: exec: report max pushs through getparam 2023-10-04 00:10:18 +02:00
nouveau_abi16.h drm/nouveau: implement new VM_BIND uAPI 2023-08-04 20:34:41 +02:00
nouveau_acpi.c drm/nouveau: Use pci_get_base_class() to reduce duplicated code 2023-09-28 16:54:54 -05:00
nouveau_acpi.h drm/nouveau: Register ACPI video backlight when nv_backlight registration fails (v2) 2022-09-03 12:17:26 +02:00
nouveau_backlight.c drm/nouveau/disp: add output backlight control methods 2023-09-19 18:22:06 -04:00
nouveau_bios.c drm/nouveau/kms/tu102-: disable vbios parsing when running on RM 2023-10-31 15:08:15 +10:00
nouveau_bios.h
nouveau_bo.c nouveau: find the smallest page allocation to cover a buffer alloc. 2023-11-29 03:03:55 +01:00
nouveau_bo.h drm/nouveau: implement new VM_BIND uAPI 2023-08-04 20:34:41 +02:00
nouveau_bo0039.c drm/ttm: rework on ttm_resource to use size_t type 2022-10-27 11:42:58 +02:00
nouveau_bo74c1.c drm/ttm: rework on ttm_resource to use size_t type 2022-10-27 11:42:58 +02:00
nouveau_bo85b5.c drm/ttm: rework on ttm_resource to use size_t type 2022-10-27 11:42:58 +02:00
nouveau_bo90b5.c drm/ttm: rework on ttm_resource to use size_t type 2022-10-27 11:42:58 +02:00
nouveau_bo5039.c drm/ttm: rework on ttm_resource to use size_t type 2022-10-27 11:42:58 +02:00
nouveau_bo9039.c drm/ttm: rework on ttm_resource to use size_t type 2022-10-27 11:42:58 +02:00
nouveau_boa0b5.c drm/ttm: rework on ttm_resource to use size_t type 2022-10-27 11:42:58 +02:00
nouveau_chan.c drm/nouveau: exec: report max pushs through getparam 2023-10-04 00:10:18 +02:00
nouveau_chan.h drm/nouveau: chan: provide nouveau_channel_kill() 2023-08-04 20:34:38 +02:00
nouveau_connector.c Merge tag 'drm-misc-next-2023-09-27' of git://anongit.freedesktop.org/drm/drm-misc into drm-next 2023-09-29 08:27:15 +10:00
nouveau_connector.h drm/nouveau/kms/nv50-: create connectors based on nvkm info 2023-09-19 18:22:27 -04:00
nouveau_crtc.h drm/nouveau/disp: expose head event class 2022-11-09 10:44:27 +10:00
nouveau_debugfs.c drm/nouveau: uvmm: rename 'umgr' to 'base' 2023-09-26 01:58:29 +02:00
nouveau_debugfs.h
nouveau_display.c nouveau: don't fail driver load if no display hw present. 2023-11-15 18:23:31 +01:00
nouveau_display.h
nouveau_dma.c drm/nouveau: uapi: don't pass NO_PREFETCH flag implicitly 2023-08-24 02:57:50 +02:00
nouveau_dma.h drm/nouveau: exec: report max pushs through getparam 2023-10-04 00:10:18 +02:00
nouveau_dmem.c drm/nouveau: fence: fix undefined fence state after emit 2023-08-31 00:46:23 +02:00
nouveau_dmem.h
nouveau_dp.c drm/nouveau/disp: move link training out of supervisor 2023-09-19 18:22:19 -04:00
nouveau_drm.c drm: Update file owner during use 2023-09-20 15:27:44 +02:00
nouveau_drv.h nouveau/u_memcpya: fix NULL vs error pointer bug 2023-09-20 00:20:08 +02:00
nouveau_encoder.h drm/nouveau/disp: add dp train method 2023-09-19 18:22:18 -04:00
nouveau_exec.c Linux 6.6-rc7 2023-10-23 18:20:06 +10:00
nouveau_exec.h drm/nouveau: exec: report max pushs through getparam 2023-10-04 00:10:18 +02:00
nouveau_fence.c drm/nouveau: fence: fix type cast warning in nouveau_fence_emit() 2023-09-20 00:15:50 +02:00
nouveau_fence.h drm/nouveau: fence: fix undefined fence state after emit 2023-08-31 00:46:23 +02:00
nouveau_gem.c drm/nouveau: fence: fix undefined fence state after emit 2023-08-31 00:46:23 +02:00
nouveau_gem.h drm/nouveau: implement new VM_BIND uAPI 2023-08-04 20:34:41 +02:00
nouveau_hwmon.c drm/nouveau: constify pointers to hwmon_channel_info 2023-05-22 16:39:04 +02:00
nouveau_hwmon.h
nouveau_ioc32.c
nouveau_ioctl.h
nouveau_led.c
nouveau_led.h drm/nouveau/led: explicitly include linux/leds.h 2023-02-15 18:05:57 -05:00
nouveau_mem.c drm/ttm: merge ttm_bo_api.h and ttm_bo_driver.h v2 2022-12-06 12:54:14 +01:00
nouveau_mem.h drm/nouveau: implement new VM_BIND uAPI 2023-08-04 20:34:41 +02:00
nouveau_nvif.c drm/nouveau/nvkm: rip out old notify 2022-11-09 10:44:27 +10:00
nouveau_platform.c
nouveau_platform.h
nouveau_prime.c drm/nouveau: implement new VM_BIND uAPI 2023-08-04 20:34:41 +02:00
nouveau_reg.h
nouveau_sched.c Merge tag 'drm-misc-next-2023-10-27' of git://anongit.freedesktop.org/drm/drm-misc into drm-next 2023-10-31 10:47:50 +10:00
nouveau_sched.h drm/nouveau: implement new VM_BIND uAPI 2023-08-04 20:34:41 +02:00
nouveau_sgdma.c drm/ttm: merge ttm_bo_api.h and ttm_bo_driver.h v2 2022-12-06 12:54:14 +01:00
nouveau_svm.c nouveau/svm: Split assignment from if conditional 2023-09-29 11:19:43 -07:00
nouveau_svm.h
nouveau_ttm.c drm/nouveau: stop using is_swiotlb_active 2023-06-07 15:11:26 +02:00
nouveau_ttm.h
nouveau_usif.c drm/nouveau/nvkm: rip out old notify 2022-11-09 10:44:27 +10:00
nouveau_usif.h
nouveau_uvmm.c drm/nouveau: uvmm: rename 'umgr' to 'base' 2023-09-26 01:58:29 +02:00
nouveau_uvmm.h drm/nouveau: uvmm: rename 'umgr' to 'base' 2023-09-26 01:58:29 +02:00
nouveau_vga.c drm/nouveau: Remove unnecessary include statements for drm_crtc_helper.h 2023-01-18 09:25:31 +01:00
nouveau_vga.h
nouveau_vmm.c drm/nouveau: nvkm/vmm: implement raw ops to manage uvmm 2023-08-04 20:34:39 +02:00
nouveau_vmm.h
nv04_fence.c
nv10_fence.c
nv10_fence.h
nv17_fence.c
nv50_display.h drm/nouveau: dispnv50: fix missing-prototypes warning 2023-05-22 16:39:04 +02:00
nv50_fence.c
nv84_fence.c drm/nouveau/fifo/ga100-: initial support 2022-11-09 10:44:50 +10:00
nvc0_fence.c