summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDamien Lespiau <damien.lespiau@intel.com>2014-08-09 19:29:31 +0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-08-11 13:29:29 +0400
commitd6699dd3a7f696a80a5f8e5bb6ecf6ff6dd7c998 (patch)
treecc6ff146510f0738b801e8e41e5c59b91fe342ed /drivers
parent3bb11b536c1037143765b4efc8056600438df7f6 (diff)
downloadlinux-d6699dd3a7f696a80a5f8e5bb6ecf6ff6dd7c998.tar.xz
drm/i915: Fix wrong number of HDMI translation entries
I keep telling myself that those tables aren't great because their size is the number of dwords we need to program and not the number of entries (number of dwords = number of entries * 2). And... I got it wrong when I refactored the code. Fortunately, it was only wrong when the VBT table (or the code parsing it) is itself erroneous. Long story short, it shouldn't matter, but still, there's a potential array overflow and random programming of the DDI translation tables. Cc: Paulo Zanoni <paulo.r.zanoni@intel.com> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/i915/intel_ddi.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index ca1f9a8a7d03..02d55843c78d 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -169,14 +169,14 @@ static void intel_prepare_ddi_buffers(struct drm_device *dev, enum port port)
ddi_translations_dp = bdw_ddi_translations_dp;
ddi_translations_edp = bdw_ddi_translations_edp;
ddi_translations_hdmi = bdw_ddi_translations_hdmi;
- n_hdmi_entries = ARRAY_SIZE(bdw_ddi_translations_hdmi);
+ n_hdmi_entries = ARRAY_SIZE(bdw_ddi_translations_hdmi) / 2;
hdmi_800mV_0dB = 7;
} else if (IS_HASWELL(dev)) {
ddi_translations_fdi = hsw_ddi_translations_fdi;
ddi_translations_dp = hsw_ddi_translations_dp;
ddi_translations_edp = hsw_ddi_translations_dp;
ddi_translations_hdmi = hsw_ddi_translations_hdmi;
- n_hdmi_entries = ARRAY_SIZE(hsw_ddi_translations_hdmi);
+ n_hdmi_entries = ARRAY_SIZE(hsw_ddi_translations_hdmi) / 2;
hdmi_800mV_0dB = 6;
} else {
WARN(1, "ddi translation table missing\n");
@@ -184,7 +184,7 @@ static void intel_prepare_ddi_buffers(struct drm_device *dev, enum port port)
ddi_translations_fdi = bdw_ddi_translations_fdi;
ddi_translations_dp = bdw_ddi_translations_dp;
ddi_translations_hdmi = bdw_ddi_translations_hdmi;
- n_hdmi_entries = ARRAY_SIZE(bdw_ddi_translations_hdmi);
+ n_hdmi_entries = ARRAY_SIZE(bdw_ddi_translations_hdmi) / 2;
hdmi_800mV_0dB = 7;
}