mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-06 08:46:46 +00:00
drm/amdgpu: Replace one-element array with flexible-array member
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 _ATOM_FAKE_EDID_PATCH_RECORD and refactor the rest of the code accordingly. Important to mention is 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/238 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>
This commit is contained in:
parent
c81c5bd5cf
commit
320e2590e2
2 changed files with 6 additions and 3 deletions
|
@ -2081,8 +2081,11 @@ amdgpu_atombios_encoder_get_lcd_info(struct amdgpu_encoder *encoder)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
record += fake_edid_record->ucFakeEDIDLength ?
|
record += fake_edid_record->ucFakeEDIDLength ?
|
||||||
fake_edid_record->ucFakeEDIDLength + 2 :
|
struct_size(fake_edid_record,
|
||||||
sizeof(ATOM_FAKE_EDID_PATCH_RECORD);
|
ucFakeEDIDString,
|
||||||
|
fake_edid_record->ucFakeEDIDLength) :
|
||||||
|
/* empty fake edid record must be 3 bytes long */
|
||||||
|
sizeof(ATOM_FAKE_EDID_PATCH_RECORD) + 1;
|
||||||
break;
|
break;
|
||||||
case LCD_PANEL_RESOLUTION_RECORD_TYPE:
|
case LCD_PANEL_RESOLUTION_RECORD_TYPE:
|
||||||
panel_res_record = (ATOM_PANEL_RESOLUTION_PATCH_RECORD *)record;
|
panel_res_record = (ATOM_PANEL_RESOLUTION_PATCH_RECORD *)record;
|
||||||
|
|
|
@ -4107,7 +4107,7 @@ typedef struct _ATOM_FAKE_EDID_PATCH_RECORD
|
||||||
{
|
{
|
||||||
UCHAR ucRecordType;
|
UCHAR ucRecordType;
|
||||||
UCHAR ucFakeEDIDLength; // = 128 means EDID length is 128 bytes, otherwise the EDID length = ucFakeEDIDLength*128
|
UCHAR ucFakeEDIDLength; // = 128 means EDID length is 128 bytes, otherwise the EDID length = ucFakeEDIDLength*128
|
||||||
UCHAR ucFakeEDIDString[1]; // This actually has ucFakeEdidLength elements.
|
UCHAR ucFakeEDIDString[]; // This actually has ucFakeEdidLength elements.
|
||||||
} ATOM_FAKE_EDID_PATCH_RECORD;
|
} ATOM_FAKE_EDID_PATCH_RECORD;
|
||||||
|
|
||||||
typedef struct _ATOM_PANEL_RESOLUTION_PATCH_RECORD
|
typedef struct _ATOM_PANEL_RESOLUTION_PATCH_RECORD
|
||||||
|
|
Loading…
Reference in a new issue