aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_bios.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/i915/intel_bios.c')
-rw-r--r--drivers/gpu/drm/i915/intel_bios.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index b3e437b3bb54..c19e669ffe50 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -42,7 +42,7 @@ find_section(const void *_bdb, int section_id)
42 const struct bdb_header *bdb = _bdb; 42 const struct bdb_header *bdb = _bdb;
43 const u8 *base = _bdb; 43 const u8 *base = _bdb;
44 int index = 0; 44 int index = 0;
45 u16 total, current_size; 45 u32 total, current_size;
46 u8 current_id; 46 u8 current_id;
47 47
48 /* skip to first section */ 48 /* skip to first section */
@@ -57,6 +57,10 @@ find_section(const void *_bdb, int section_id)
57 current_size = *((const u16 *)(base + index)); 57 current_size = *((const u16 *)(base + index));
58 index += 2; 58 index += 2;
59 59
60 /* The MIPI Sequence Block v3+ has a separate size field. */
61 if (current_id == BDB_MIPI_SEQUENCE && *(base + index) >= 3)
62 current_size = *((const u32 *)(base + index + 1));
63
60 if (index + current_size > total) 64 if (index + current_size > total)
61 return NULL; 65 return NULL;
62 66
@@ -799,6 +803,12 @@ parse_mipi(struct drm_i915_private *dev_priv, const struct bdb_header *bdb)
799 return; 803 return;
800 } 804 }
801 805
806 /* Fail gracefully for forward incompatible sequence block. */
807 if (sequence->version >= 3) {
808 DRM_ERROR("Unable to parse MIPI Sequence Block v3+\n");
809 return;
810 }
811
802 DRM_DEBUG_DRIVER("Found MIPI sequence block\n"); 812 DRM_DEBUG_DRIVER("Found MIPI sequence block\n");
803 813
804 block_size = get_blocksize(sequence); 814 block_size = get_blocksize(sequence);