Commit d1dd9908 authored by Jani Nikula's avatar Jani Nikula

drm/i915/hti: avoid theoretically possible negative shift

If phy is PHY_NONE, the shift to register bits becomes negative. Check
and warn about this.
Reported-by: default avatarcoverity-bot <keescook@chromium.org>
References: https://lore.kernel.org/r/202211180848.D39006C@keescookSigned-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Reviewed-by: default avatarKees Cook <keescook@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20221122120948.3436180-1-jani.nikula@intel.com
parent 67630bac
......@@ -21,6 +21,9 @@ void intel_hti_init(struct drm_i915_private *i915)
bool intel_hti_uses_phy(struct drm_i915_private *i915, enum phy phy)
{
if (drm_WARN_ON(&i915->drm, phy == PHY_NONE))
return false;
return i915->display.hti.state & HDPORT_ENABLED &&
i915->display.hti.state & HDPORT_DDI_USED(phy);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment