From: coverity-bot <keescook@chromium.org>
To: Jani Nikula <jani.nikula@intel.com>
Cc: "Jani Nikula" <jani.nikula@linux.intel.com>,
"David Airlie" <airlied@gmail.com>,
"Ville Syrjälä" <ville.syrjala@linux.intel.com>,
"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
"Lucas De Marchi" <lucas.demarchi@intel.com>,
"Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>,
intel-gfx@lists.freedesktop.org,
"Tvrtko Ursulin" <tvrtko.ursulin@linux.intel.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
"Daniel Vetter" <daniel@ffwll.ch>,
"Arun R Murthy" <arun.r.murthy@intel.com>,
"Imre Deak" <imre.deak@intel.com>,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
linux-next@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Coverity: intel_hti_uses_phy(): Integer handling issues
Date: Fri, 18 Nov 2022 08:49:24 -0800 [thread overview]
Message-ID: <202211180848.D39006C@keescook> (raw)
Hello!
This is an experimental semi-automated report about issues detected by
Coverity from a scan of next-20221118 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan
You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by commits:
Thu Nov 17 16:12:56 2022 +0200
62749912540b ("drm/i915/display: move hti under display sub-struct")
Coverity reported the following:
*** CID 1527374: Integer handling issues (BAD_SHIFT)
drivers/gpu/drm/i915/display/intel_hti.c:24 in intel_hti_uses_phy()
18 if (INTEL_INFO(i915)->display.has_hti)
19 i915->display.hti.state = intel_de_read(i915, HDPORT_STATE);
20 }
21
22 bool intel_hti_uses_phy(struct drm_i915_private *i915, enum phy phy)
23 {
vvv CID 1527374: Integer handling issues (BAD_SHIFT)
vvv In expression "1UL << 2 * phy + 1", shifting by a negative amount has undefined behavior. The shift amount, "2 * phy + 1", is as little as -1.
24 return i915->display.hti.state & HDPORT_ENABLED &&
25 i915->display.hti.state & HDPORT_DDI_USED(phy);
26 }
27
28 u32 intel_hti_dpll_mask(struct drm_i915_private *i915)
29 {
If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):
Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Addresses-Coverity-ID: 1527374 ("Integer handling issues")
Fixes: 62749912540b ("drm/i915/display: move hti under display sub-struct")
This code appears to be safe currently (intel_hti_uses_phy() is never
called with PHY_NONE), but perhaps add an explicit check?
if (WARN_ON(phy == PHY_NONE))
return false;
Thanks for your attention!
--
Coverity-bot
WARNING: multiple messages have this Message-ID (diff)
From: coverity-bot <keescook@chromium.org>
To: Jani Nikula <jani.nikula@intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
intel-gfx@lists.freedesktop.org,
Lucas De Marchi <lucas.demarchi@intel.com>,
linux-kernel@vger.kernel.org, linux-next@vger.kernel.org,
dri-devel@lists.freedesktop.org,
Rodrigo Vivi <rodrigo.vivi@intel.com>,
Arun R Murthy <arun.r.murthy@intel.com>,
linux-hardening@vger.kernel.org
Subject: Coverity: intel_hti_uses_phy(): Integer handling issues
Date: Fri, 18 Nov 2022 08:49:24 -0800 [thread overview]
Message-ID: <202211180848.D39006C@keescook> (raw)
Hello!
This is an experimental semi-automated report about issues detected by
Coverity from a scan of next-20221118 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan
You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by commits:
Thu Nov 17 16:12:56 2022 +0200
62749912540b ("drm/i915/display: move hti under display sub-struct")
Coverity reported the following:
*** CID 1527374: Integer handling issues (BAD_SHIFT)
drivers/gpu/drm/i915/display/intel_hti.c:24 in intel_hti_uses_phy()
18 if (INTEL_INFO(i915)->display.has_hti)
19 i915->display.hti.state = intel_de_read(i915, HDPORT_STATE);
20 }
21
22 bool intel_hti_uses_phy(struct drm_i915_private *i915, enum phy phy)
23 {
vvv CID 1527374: Integer handling issues (BAD_SHIFT)
vvv In expression "1UL << 2 * phy + 1", shifting by a negative amount has undefined behavior. The shift amount, "2 * phy + 1", is as little as -1.
24 return i915->display.hti.state & HDPORT_ENABLED &&
25 i915->display.hti.state & HDPORT_DDI_USED(phy);
26 }
27
28 u32 intel_hti_dpll_mask(struct drm_i915_private *i915)
29 {
If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):
Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Addresses-Coverity-ID: 1527374 ("Integer handling issues")
Fixes: 62749912540b ("drm/i915/display: move hti under display sub-struct")
This code appears to be safe currently (intel_hti_uses_phy() is never
called with PHY_NONE), but perhaps add an explicit check?
if (WARN_ON(phy == PHY_NONE))
return false;
Thanks for your attention!
--
Coverity-bot
WARNING: multiple messages have this Message-ID (diff)
From: coverity-bot <keescook@chromium.org>
To: Jani Nikula <jani.nikula@intel.com>
Cc: "Gustavo A. R. Silva" <gustavo@embeddedor.com>,
intel-gfx@lists.freedesktop.org,
Lucas De Marchi <lucas.demarchi@intel.com>,
linux-kernel@vger.kernel.org, linux-next@vger.kernel.org,
dri-devel@lists.freedesktop.org, Daniel Vetter <daniel@ffwll.ch>,
Rodrigo Vivi <rodrigo.vivi@intel.com>,
David Airlie <airlied@gmail.com>,
linux-hardening@vger.kernel.org
Subject: [Intel-gfx] Coverity: intel_hti_uses_phy(): Integer handling issues
Date: Fri, 18 Nov 2022 08:49:24 -0800 [thread overview]
Message-ID: <202211180848.D39006C@keescook> (raw)
Hello!
This is an experimental semi-automated report about issues detected by
Coverity from a scan of next-20221118 as part of the linux-next scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan
You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by commits:
Thu Nov 17 16:12:56 2022 +0200
62749912540b ("drm/i915/display: move hti under display sub-struct")
Coverity reported the following:
*** CID 1527374: Integer handling issues (BAD_SHIFT)
drivers/gpu/drm/i915/display/intel_hti.c:24 in intel_hti_uses_phy()
18 if (INTEL_INFO(i915)->display.has_hti)
19 i915->display.hti.state = intel_de_read(i915, HDPORT_STATE);
20 }
21
22 bool intel_hti_uses_phy(struct drm_i915_private *i915, enum phy phy)
23 {
vvv CID 1527374: Integer handling issues (BAD_SHIFT)
vvv In expression "1UL << 2 * phy + 1", shifting by a negative amount has undefined behavior. The shift amount, "2 * phy + 1", is as little as -1.
24 return i915->display.hti.state & HDPORT_ENABLED &&
25 i915->display.hti.state & HDPORT_DDI_USED(phy);
26 }
27
28 u32 intel_hti_dpll_mask(struct drm_i915_private *i915)
29 {
If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):
Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Addresses-Coverity-ID: 1527374 ("Integer handling issues")
Fixes: 62749912540b ("drm/i915/display: move hti under display sub-struct")
This code appears to be safe currently (intel_hti_uses_phy() is never
called with PHY_NONE), but perhaps add an explicit check?
if (WARN_ON(phy == PHY_NONE))
return false;
Thanks for your attention!
--
Coverity-bot
next reply other threads:[~2022-11-18 16:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-18 16:49 coverity-bot [this message]
2022-11-18 16:49 ` [Intel-gfx] Coverity: intel_hti_uses_phy(): Integer handling issues coverity-bot
2022-11-18 16:49 ` coverity-bot
2022-11-22 12:48 ` Jani Nikula
2022-11-22 12:48 ` [Intel-gfx] " Jani Nikula
2022-11-22 12:48 ` Jani Nikula
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202211180848.D39006C@keescook \
--to=keescook@chromium.org \
--cc=airlied@gmail.com \
--cc=arun.r.murthy@intel.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=gustavo@embeddedor.com \
--cc=imre.deak@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
--cc=jani.nikula@linux.intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=lucas.demarchi@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=tvrtko.ursulin@linux.intel.com \
--cc=ville.syrjala@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.