Linux-Next Archive on lore.kernel.org
 help / color / Atom feed
From: coverity-bot <keescook@chromium.org>
To: Roman Li <Roman.Li@amd.com>
Cc: Leo Li <sunpeng.li@amd.com>,
	Alex Deucher <alexander.deucher@amd.com>,
	Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	linux-next@vger.kernel.org
Subject: Coverity: dc_link_setup_psr(): Integer handling issues
Date: Mon, 4 Nov 2019 09:39:31 -0800
Message-ID: <201911040939.007EA1E6@keescook> (raw)

Hello!

This is an experimental automated report about issues detected by Coverity
from a scan of next-20191031 as part of the linux-next weekly 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 recent commits:

e0d08a40a63b ("drm/amd/display: Add debugfs entry for reading psr state")

Coverity reported the following:

*** CID 1487399:  Integer handling issues  (OVERFLOW_BEFORE_WIDEN)
/drivers/gpu/drm/amd/display/dc/core/dc_link.c: 2559 in dc_link_setup_psr()
2553     	psr_context->phyType = PHY_TYPE_UNIPHY;
2554     	/*PhyId is associated with the transmitter id*/
2555     	psr_context->smuPhyId =
2556     		transmitter_to_phy_id(link->link_enc->transmitter);
2557
2558     	psr_context->crtcTimingVerticalTotal = stream->timing.v_total;
vvv     CID 1487399:  Integer handling issues  (OVERFLOW_BEFORE_WIDEN)
vvv     Potentially overflowing expression "stream->timing.pix_clk_100hz * 100U" with type "unsigned int" (32 bits, unsigned) is evaluated using 32-bit arithmetic, and then used in a context that expects an expression of type "u64" (64 bits, unsigned).
2559     	psr_context->vsyncRateHz = div64_u64(div64_u64((stream->
2560     					timing.pix_clk_100hz * 100),
2561     					stream->timing.v_total),
2562     					stream->timing.h_total);
2563
2564     	psr_context->psrSupportedDisplayConfig = true;

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: 1487399 ("Integer handling issues")
Fixes: e0d08a40a63b ("drm/amd/display: Add debugfs entry for reading psr state")


Thanks for your attention!

-- 
Coverity-bot

                 reply index

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publically 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=201911040939.007EA1E6@keescook \
    --to=keescook@chromium.org \
    --cc=Nicholas.Kazlauskas@amd.com \
    --cc=Roman.Li@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=gustavo@embeddedor.com \
    --cc=linux-next@vger.kernel.org \
    --cc=sunpeng.li@amd.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

Linux-Next Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-next/0 linux-next/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-next linux-next/ https://lore.kernel.org/linux-next \
		linux-next@vger.kernel.org
	public-inbox-index linux-next

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-next


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git