提交 8c8a854d 编写于 作者: D Dan Carpenter 提交者: Jani Nikula

drm/i915/bios: fix off by one in parse_generic_dtd()

The "num_dtd" variable is the number of elements in the
generic_dtd->dtd[] array so the > needs to be >= to prevent reading one
element beyond the end of the array.

Fixes: 33ef6d4f ("drm/i915/vbt: Handle generic DTD block")
Reviewed-by: NMatt Roper <matthew.d.roper@intel.com>
Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191212091130.zf2g53njf5u24wk6@kili.mountain
上级 601a9ee0
......@@ -340,7 +340,7 @@ parse_generic_dtd(struct drm_i915_private *dev_priv,
num_dtd = (get_blocksize(generic_dtd) -
sizeof(struct bdb_generic_dtd)) / generic_dtd->gdtd_size;
if (dev_priv->vbt.panel_type > num_dtd) {
if (dev_priv->vbt.panel_type >= num_dtd) {
DRM_ERROR("Panel type %d not found in table of %d DTD's\n",
dev_priv->vbt.panel_type, num_dtd);
return;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册