linux-imx/drivers/gpu/drm/radeon
Bill Wendling ea12dbf570 drm/radeon: Remove __counted_by from StateArray.states[]
commit 2bac084468 upstream.

Work for __counted_by on generic pointers in structures (not just
flexible array members) has started landing in Clang 19 (current tip of
tree). During the development of this feature, a restriction was added
to __counted_by to prevent the flexible array member's element type from
including a flexible array member itself such as:

  struct foo {
    int count;
    char buf[];
  };

  struct bar {
    int count;
    struct foo data[] __counted_by(count);
  };

because the size of data cannot be calculated with the standard array
size formula:

  sizeof(struct foo) * count

This restriction was downgraded to a warning but due to CONFIG_WERROR,
it can still break the build. The application of __counted_by on the
states member of 'struct _StateArray' triggers this restriction,
resulting in:

  drivers/gpu/drm/radeon/pptable.h:442:5: error: 'counted_by' should not be applied to an array with element of unknown size because 'ATOM_PPLIB_STATE_V2' (aka 'struct _ATOM_PPLIB_STATE_V2') is a struct type with a flexible array member. This will be an error in a future compiler version [-Werror,-Wbounds-safety-counted-by-elt-type-unknown-size]
    442 |     ATOM_PPLIB_STATE_V2 states[] __counted_by(ucNumEntries);
        |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
  1 error generated.

Remove this use of __counted_by to fix the warning/error. However,
rather than remove it altogether, leave it commented, as it may be
possible to support this in future compiler releases.

Cc: stable@vger.kernel.org
Closes: https://github.com/ClangBuiltLinux/linux/issues/2028
Fixes: efade6fe50 ("drm/radeon: silence UBSAN warning (v3)")
Signed-off-by: Bill Wendling <morbo@google.com>
Co-developed-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-08-14 13:59:01 +02:00
..
reg_srcs
.gitignore
atom-bits.h
atom-names.h drm/radeon: introduce kernel modesetting for radeon hardware 2009-06-15 12:01:53 +10:00
atom-types.h
atom.c drm/radeon: Fix multiple line dereference in 'atom_iio_execute' 2023-08-15 17:43:48 -04:00
atom.h
atombios_crtc.c drm/radeon: Remove unnecessary include statements for drm_crtc_helper.h 2023-01-18 09:25:31 +01:00
atombios_dp.c
atombios_encoders.c drm/radeon: Fix eDP for single-display iMac11,2 2023-03-01 22:37:25 -05:00
atombios_i2c.c
atombios.h
avivod.h
btc_dpm.c
btc_dpm.h
btcd.h drm/radeon/dpm: use the driver state for dpm debugfs 2014-02-06 12:22:46 -05:00
cayman_blit_shaders.h
ci_dpm.c radeon: avoid double free in ci_dpm_init() 2023-04-18 16:28:54 -04:00
ci_dpm.h
ci_smc.c
cik_blit_shaders.h drm/radeon: change cik_default_state table from global to static 2022-04-26 11:43:51 -04:00
cik_reg.h
cik_sdma.c
cik.c pci-v6.6-changes 2023-08-30 20:23:07 -07:00
cik.h
cikd.h
clearstate_cayman.h
clearstate_ci.h
clearstate_defs.h
clearstate_evergreen.h
clearstate_si.h drm/radeon: that open brace { should be on the previous line 2023-07-27 14:47:29 -04:00
cypress_dpm.c drm/radeon: fix possible division-by-zero errors 2023-06-09 10:44:47 -04:00
cypress_dpm.h
dce3_1_afmt.c
dce6_afmt.c
dce6_afmt.h
evergreen_blit_shaders.h
evergreen_cs.c
evergreen_dma.c
evergreen_hdmi.c
evergreen_hdmi.h
evergreen_reg.h
evergreen_smc.h
evergreen.c drm/radeon: possible buffer overflow 2023-11-20 11:59:09 +01:00
evergreen.h
evergreend.h
Kconfig fbdev: Use _IOMEM_ infix for I/O-memory helpers 2023-07-31 20:06:52 +02:00
kv_dpm.c
kv_dpm.h
kv_smc.c
Makefile drm/radeon: Only build fbdev if DRM_FBDEV_EMULATION is set 2023-03-31 11:18:42 -04:00
mkregtable.c
ni_dma.c
ni_dpm.c drm/radeon: fix possible division-by-zero errors 2023-06-09 10:44:47 -04:00
ni_dpm.h
ni_reg.h
ni.c drm/radeon/ni: Fix wrong firmware size logging in ni_init_microcode() 2024-03-26 18:19:47 -04:00
ni.h
nid.h
nislands_smc.h
ObjectID.h
ppsmc.h
pptable.h drm/radeon: Remove __counted_by from StateArray.states[] 2024-08-14 13:59:01 +02:00
r100_track.h drm/radeon: prepare header files for drmP.h removal 2019-06-10 22:30:24 +02:00
r100.c drm/radeon/r100: Fix integer overflow issues in r100_cs_track_check() 2024-01-25 15:35:32 -08:00
r100d.h
r200.c
r300_reg.h
r300.c drm/radeon: Fix format error 2023-07-27 14:59:29 -04:00
r300d.h
r420.c drm/radeon: Remove unnecessary (void*) conversions 2023-06-09 10:40:55 -04:00
r420d.h
r500_reg.h
r520.c
r520d.h
r600_cs.c drm/radeon/r600_cs: Fix possible int overflows in r600_cs_check_reg() 2024-01-25 15:35:32 -08:00
r600_dma.c
r600_dpm.c
r600_dpm.h
r600_hdmi.c
r600_reg.h
r600.c drm: Spelling s/sempahore/semaphore/ 2023-07-29 21:05:10 +02:00
r600.h
r600d.h
radeon_acpi.c drm/radeon: Use pci_dev_id() to simplify the code 2023-08-15 18:08:29 -04:00
radeon_acpi.h drm/radeon: Fix missing prototypes in radeon_atpx_handler.c 2023-06-15 11:06:58 -04:00
radeon_agp.c drm/radeon: Remove unnecessary NULL values 2023-08-15 18:08:27 -04:00
radeon_asic.c drm/radeon: Remove unnecessary include statements for drm_crtc_helper.h 2023-01-18 09:25:31 +01:00
radeon_asic.h
radeon_atombios.c drm/radeon: make -fstrict-flex-arrays=3 happy 2024-04-27 17:11:35 +02:00
radeon_atombios.h
radeon_atpx_handler.c Revert "drm/radeon: Prefer dev_* variant over printk" 2023-08-07 17:12:49 -04:00
radeon_audio.c drm/radeon: Add HD-audio component notifier support (v6) 2022-11-10 15:29:00 -05:00
radeon_audio.h drm/radeon/radeon_audio: Move 'dce3_2_*' prototypes to shared location 2020-11-16 15:56:33 -05:00
radeon_benchmark.c
radeon_bios.c
radeon_clocks.c
radeon_combios.c drm/radeon: Remove unnecessary NULL values 2023-08-15 18:08:27 -04:00
radeon_connectors.c drm/radeon: fix a possible null pointer dereference 2023-11-28 17:19:41 +00:00
radeon_cs.c drm/radeon: Fix integer overflow in radeon_cs_parser_init 2023-04-21 08:50:21 -04:00
radeon_cursor.c
radeon_device.c Merge tag 'amd-drm-next-6.3-2023-01-13' of https://gitlab.freedesktop.org/agd5f/linux into drm-next 2023-01-16 15:04:13 +10:00
radeon_device.h
radeon_display.c drm/radeon/radeon_display: Decrease the size of allocated memory 2024-07-05 09:33:52 +02:00
radeon_dp_auxch.c drm/radeon: Do not use deprecated drm log API 2023-01-18 10:00:03 +01:00
radeon_drv.c drm/radeon: Remove the references of radeon_gem_ pread & pwrite ioctls 2023-11-20 11:59:09 +01:00
radeon_drv.h drm/radeon: Avoid externs & do not initialize globals to 0 in radeon_drv.c 2023-07-25 13:36:47 -04:00
radeon_encoders.c drm/radeon: Fix style issues in radeon _encoders.c & _gart.c 2023-07-25 13:37:05 -04:00
radeon_family.h
radeon_fbdev.c fbdev: Use _IOMEM_ infix for I/O-memory helpers 2023-07-31 20:06:52 +02:00
radeon_fence.c drm/radeon: Remove unnecessary (void*) conversions 2023-06-09 10:40:55 -04:00
radeon_gart.c drm/radeon: Fix style issues in radeon _encoders.c & _gart.c 2023-07-25 13:37:05 -04:00
radeon_gem.c drm/radeon: check bo_va->bo is non-NULL before using it 2024-07-25 09:50:54 +02:00
radeon_i2c.c
radeon_ib.c drm/radeon: Remove unnecessary (void*) conversions 2023-06-09 10:40:55 -04:00
radeon_irq_kms.c drm/radeon: reintroduce radeon_dp_work_func content 2023-06-09 10:42:07 -04:00
radeon_kms.c drm/radeon: ERROR: "(foo*)" should be "(foo *)" 2023-07-12 11:12:09 -04:00
radeon_kms.h
radeon_legacy_crtc.c drm/radeon: Remove unnecessary include statements for drm_crtc_helper.h 2023-01-18 09:25:31 +01:00
radeon_legacy_encoders.c drm/radeon: Remove unnecessary NULL values 2023-08-15 18:08:27 -04:00
radeon_legacy_encoders.h
radeon_legacy_tv.c drm/radeon: Move assignment outside if condition 2023-07-27 14:47:34 -04:00
radeon_mn.c
radeon_mode.h drm/radeon: Only build fbdev if DRM_FBDEV_EMULATION is set 2023-03-31 11:18:42 -04:00
radeon_object.c
radeon_object.h drm/radeon: Use the drm suballocation manager implementation. 2023-03-01 17:18:19 +01:00
radeon_pm.c drm/radeon: Remove unnecessary (void*) conversions 2023-06-09 10:40:55 -04:00
radeon_pm.h
radeon_prime.c
radeon_prime.h
radeon_reg.h
radeon_ring.c drm/radeon: Remove unnecessary (void*) conversions 2023-06-09 10:40:55 -04:00
radeon_sa.c drm/radeon: make fence wait in suballocator uninterrruptable 2023-09-07 17:45:34 +02:00
radeon_semaphore.c drm/radeon: Use the drm suballocation manager implementation. 2023-03-01 17:18:19 +01:00
radeon_sync.c
radeon_test.c drm/radeon: ERROR: "(foo*)" should be "(foo *)" 2023-07-12 11:12:09 -04:00
radeon_trace_points.c
radeon_trace.h
radeon_ttm.c drm changes for 6.5-rc1: 2023-06-29 11:00:17 -07:00
radeon_ttm.h
radeon_ucode.c
radeon_ucode.h
radeon_uvd.c
radeon_vce.c drm/radeon: add missing spaces before ';' 2023-07-25 13:47:27 -04:00
radeon_vm.c gpu/drm/radeon: fix two memleaks in radeon_vm_init 2024-01-25 15:35:36 -08:00
radeon.h drm/radeon/radeon_display: Decrease the size of allocated memory 2024-07-05 09:33:52 +02:00
rs100d.h
rs400.c drm/radeon: Remove unnecessary (void*) conversions 2023-06-09 10:40:55 -04:00
rs400d.h
rs600.c
rs600d.h
rs690.c
rs690d.h
rs780_dpm.c
rs780_dpm.h
rs780d.h
rv6xx_dpm.c
rv6xx_dpm.h
rv6xxd.h
rv200d.h
rv250d.h
rv350d.h
rv515.c drm/radeon: Remove unnecessary (void*) conversions 2023-06-09 10:40:55 -04:00
rv515d.h
rv730_dpm.c
rv730d.h
rv740_dpm.c drm/radeon: fix possible division-by-zero errors 2023-06-09 10:44:47 -04:00
rv740d.h
rv770_dma.c
rv770_dpm.c
rv770_dpm.h
rv770_smc.c drm/radeon: that open brace { should be on the previous line 2023-07-27 14:47:31 -04:00
rv770_smc.h
rv770.c drm/radeon: ERROR: that open brace { should be on the previous line 2023-07-12 11:12:09 -04:00
rv770.h
rv770d.h
si_blit_shaders.h
si_dma.c
si_dpm.c
si_dpm.h
si_reg.h
si_smc.c
si.c drm/radeon: check return value of radeon_ring_lock() 2024-01-25 15:35:32 -08:00
si.h
sid.h
sislands_smc.h drm/radeon/si_dpm: open brace '{' following struct go on the same line 2023-07-25 13:47:27 -04:00
smu7_discrete.h
smu7_fusion.h
smu7.h
sumo_dpm.c drm/radeon: fix UBSAN warning in kv_dpm.c 2024-06-27 13:49:12 +02:00
sumo_dpm.h
sumo_smc.c
sumod.h
trinity_dpm.c drm/radeon/trinity_dpm: fix a memleak in trinity_parse_power_table 2024-01-25 15:35:34 -08:00
trinity_dpm.h
trinity_smc.c
trinityd.h
uvd_v1_0.c
uvd_v2_2.c
uvd_v3_1.c
uvd_v4_2.c
vce_v1_0.c
vce_v2_0.c
vce.h