drm/amdgpu: Replace remaining 1-element array with flex-array
Subsystems (2)
PATCH 1/1 drm/amdgpu: Replace remaining 1-element array with flex-array
One-element arrays are deprecated, and we are replacing them with flexible array members instead. So, replace one-element array with flexible-array member in struct GOP_VBIOS_CONTENT and refactor the rest of the code accordingly.
Important to mention is that doing a build before/after this patch results in no functional binary output differences.
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 [1].
---
This should be the last one-element array that had references in source code. Given the way it was used, no *.c code change was required.
I will move on to the atombios.h in the radeon driver.
--- drivers/gpu/drm/amd/include/atombios.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/include/atombios.h +1 -1
@@ -9292,7 +9292,7 @@ typedef struct {typedef struct {VFCT_IMAGE_HEADER VbiosHeader; -UCHAR VbiosContent[1 ]; +UCHAR VbiosContent[]; }GOP_VBIOS_CONTENT ; typedef struct {
Signature · 1 line
2.37.3
Alex Deucher
AppliedApplied. Thanks!
Alex
Quoted 43 lines · Paulo Miguel Almeida
One-element arrays are deprecated, and we are replacing them with flexible array members instead. So, replace one-element array with flexible-array member in struct
GOP_VBIOS_CONTENTand refactor the rest of the code accordingly.Important to mention is that doing a build before/after this patch results in no functional binary output differences.
This helps with the ongoing efforts to tighten the
FORTIFY_SOURCEroutines onmemcpy()and help us make progress towards globally enabling -fstrict-flex-arrays=3 [1].Signed-off-by Paulo Miguel Almeida <[email protected]>---
This should be the last one-element array that had references in source code. Given the way it was used, no *.c code change was required.I will move on to the
atombios.hin the radeon driver.--- drivers/gpu/drm/amd/include/atombios.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/amd/include/atombios.h +1
-2@@ -9292,7 +9292,7 @@ typedef struct {typedef struct {VFCT_IMAGE_HEADER VbiosHeader; -UCHAR VbiosContent[1 ]; +UCHAR VbiosContent[]; }GOP_VBIOS_CONTENT ; typedef struct { --2.37.3