Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/radeon: Replace 1-element arrays with flexible-array members

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 structs _ATOM_DISPLAY_OBJECT_PATH,
_ATOM_DISPLAY_OBJECT_PATH_TABLE, _ATOM_OBJECT_TABLE, GOP_VBIOS_CONTENT
_ATOM_GPIO_VOLTAGE_OBJECT_V3 and refactor the rest of the code accordingly.

It's worth mentioning that doing a build before/after this patch
results in no 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].

Link: https://github.com/KSPP/linux/issues/79
Link: https://github.com/KSPP/linux/issues/239
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836 [1]

Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Paulo Miguel Almeida and committed by
Alex Deucher
09ccde91 2dd9032b

+5 -5
+5 -5
drivers/gpu/drm/radeon/atombios.h
··· 4020 4020 USHORT usSize; //the size of ATOM_DISPLAY_OBJECT_PATH 4021 4021 USHORT usConnObjectId; //Connector Object ID 4022 4022 USHORT usGPUObjectId; //GPU ID 4023 - USHORT usGraphicObjIds[1]; //1st Encoder Obj source from GPU to last Graphic Obj destinate to connector. 4023 + USHORT usGraphicObjIds[]; //1st Encoder Obj source from GPU to last Graphic Obj destinate to connector. 4024 4024 }ATOM_DISPLAY_OBJECT_PATH; 4025 4025 4026 4026 typedef struct _ATOM_DISPLAY_EXTERNAL_OBJECT_PATH ··· 4037 4037 UCHAR ucNumOfDispPath; 4038 4038 UCHAR ucVersion; 4039 4039 UCHAR ucPadding[2]; 4040 - ATOM_DISPLAY_OBJECT_PATH asDispPath[1]; 4040 + ATOM_DISPLAY_OBJECT_PATH asDispPath[]; 4041 4041 }ATOM_DISPLAY_OBJECT_PATH_TABLE; 4042 4042 4043 4043 ··· 4053 4053 { 4054 4054 UCHAR ucNumberOfObjects; 4055 4055 UCHAR ucPadding[3]; 4056 - ATOM_OBJECT asObjects[1]; 4056 + ATOM_OBJECT asObjects[]; 4057 4057 }ATOM_OBJECT_TABLE; 4058 4058 4059 4059 typedef struct _ATOM_SRC_DST_TABLE_FOR_ONE_OBJECT //usSrcDstTableOffset pointing to this structure ··· 4615 4615 UCHAR ucPhaseDelay; // phase delay in unit of micro second 4616 4616 UCHAR ucReserved; 4617 4617 ULONG ulGpioMaskVal; // GPIO Mask value 4618 - VOLTAGE_LUT_ENTRY_V2 asVolGpioLut[1]; 4618 + VOLTAGE_LUT_ENTRY_V2 asVolGpioLut[]; 4619 4619 }ATOM_GPIO_VOLTAGE_OBJECT_V3; 4620 4620 4621 4621 typedef struct _ATOM_LEAKAGE_VOLTAGE_OBJECT_V3 ··· 7964 7964 7965 7965 typedef struct { 7966 7966 VFCT_IMAGE_HEADER VbiosHeader; 7967 - UCHAR VbiosContent[1]; 7967 + UCHAR VbiosContent[]; 7968 7968 }GOP_VBIOS_CONTENT; 7969 7969 7970 7970 typedef struct {