KSPP / linux

Linux kernel source tree (Kernel Self Protection Project)
https://kernsec.org/wiki/index.php/Kernel_Self_Protection_Project
Other
80 stars 5 forks source link

Replace 1-element arrays in drivers/gpu/drm/radeon/atombios.h #239

Closed PauloMigAlmeida closed 1 year ago

PauloMigAlmeida commented 1 year ago
3614 typedef struct _ATOM_FAKE_EDID_PATCH_RECORD
3615 {
3616   UCHAR ucRecordType;
3617   UCHAR ucFakeEDIDLength;
3618   UCHAR ucFakeEDIDString[1];    // This actually has ucFakeEdidLength elements.
3619 } ATOM_FAKE_EDID_PATCH_RECORD;

Audit (at least) all these places where the flex arrays are being used:

if (edid) {
         memcpy((u8 *)edid, (u8 *)&fake_edid_record->ucFakeEDIDString[0],
                fake_edid_record->ucFakeEDIDLength);

         if (drm_edid_is_valid(edid)) {
                 rdev->mode_info.bios_hardcoded_edid = edid;
                 rdev->mode_info.bios_hardcoded_edid_size = edid_size;
         } else
                 kfree(edid);
   }
PauloMigAlmeida commented 1 year ago

Patch sent https://lore.kernel.org/lkml/Y1trhRE3nK5iAY6q@mail.google.com/T/#u

PauloMigAlmeida commented 1 year ago

V2: https://lore.kernel.org/lkml/Y1yetX1CHsr+fibp@mail.google.com/

PauloMigAlmeida commented 1 year ago

Merged