drm/i915/bios: Make copies of VBT data blocks
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 6 Apr 2022 13:38:17 +0000 (16:38 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Tue, 12 Apr 2022 06:18:14 +0000 (09:18 +0300)
commite163cfb4c96d022b93ab0006ab306de50b6d7c6b
tree916d5e5f0bcff49411d6cb15c3d96f8c904bf7aa
parentd58a3d699797a59dae53542b20e2f03ba3f05036
drm/i915/bios: Make copies of VBT data blocks

Make a copy of each VBT data block with a guaranteed minimum
size. The extra (if any) will just be left zeroed.

This means we don't have to worry about going out of bounds
when accessing any of the structure members. Otherwise that
could easliy happen if we simply get the version check wrong,
or if the VBT is broken/malicious.

v2: Don't do arithmetic between bdb header and copy
    of the LFP data block (Jani)
v3: Make all the copies up front
v4: Only WARN about min_size==0 if we found the block

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220406133817.30652-1-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/display/intel_bios.c
drivers/gpu/drm/i915/i915_drv.h