From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Eric Anholt <eric@anholt.net>, David Airlie <airlied@linux.ie>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/pl111: Use 64-bit arithmetic instead of 32-bit
Date: Wed, 4 Jul 2018 09:11:27 -0500 [thread overview]
Message-ID: <aacd8a63-988a-6188-22cd-40d5e3c241ee@embeddedor.com> (raw)
In-Reply-To: <20180703235119.GA20877@embeddedor.com>
Hi,
Please, ignore this. I should have used ULL instead of UL.
I'll send v2 shortly.
Thanks
--
Gustavo
On 07/03/2018 06:51 PM, Gustavo A. R. Silva wrote:
> Add suffix UL to constant 1000 in order to give the compiler complete
> information about the proper arithmetic to use.
>
> Notice that such constant is used in a context that expects an
> expression of type u64 (64 bits, unsigned) and the following
> expression is currently being evaluated using 32-bit arithmetic:
>
> mode->clock * 1000
>
> Addresses-Coverity-ID: 1466139 ("Unintentional integer overflow")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
> drivers/gpu/drm/pl111/pl111_display.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/pl111/pl111_display.c b/drivers/gpu/drm/pl111/pl111_display.c
> index a432eb7..61d51b4 100644
> --- a/drivers/gpu/drm/pl111/pl111_display.c
> +++ b/drivers/gpu/drm/pl111/pl111_display.c
> @@ -63,7 +63,7 @@ pl111_mode_valid(struct drm_crtc *crtc,
> * We use the pixelclock to also account for interlaced modes, the
> * resulting bandwidth is in bytes per second.
> */
> - bw = mode->clock * 1000; /* In Hz */
> + bw = mode->clock * 1000UL; /* In Hz */
> bw = bw * mode->hdisplay * mode->vdisplay * cpp;
> bw = div_u64(bw, mode->htotal * mode->vtotal);
>
>
prev parent reply other threads:[~2018-07-04 14:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-03 23:51 Gustavo A. R. Silva
2018-07-04 14:11 ` Gustavo A. R. Silva [this message]
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=aacd8a63-988a-6188-22cd-40d5e3c241ee@embeddedor.com \
--to=gustavo@embeddedor.com \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=eric@anholt.net \
--cc=linux-kernel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome