From: Thierry Reding <thierry.reding@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "Terje Bergström" <tbergstrom@nvidia.com>,
dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [patch 1/2] gpu: host1x: fix an integer overflow check
Date: Tue, 27 Aug 2013 10:30:24 +0200 [thread overview]
Message-ID: <20130827083023.GJ8686@ulmo> (raw)
In-Reply-To: <20130823101825.GA1765@elgon.mountain>
[-- Attachment #1: Type: text/plain, Size: 796 bytes --]
On Fri, Aug 23, 2013 at 01:18:25PM +0300, Dan Carpenter wrote:
> Tegra is a 32 bit arch. On 32 bit systems then size_t is 32 bits so
> "total" will never be higher than UINT_MAX because of integer overflows.
> We need cast to u64 first before doing the math.
>
> Also the addition earlier:
>
> unsigned int num_unpins = num_cmdbufs + num_relocs;
>
> That can overflow as well, but I think it's still safe because we check
> both "num_cmdbufs" and "num_relocs" again in this test.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> This is something I spotted in code review. I can't actually compile
> this code. I assume this overflow test has security implications.
It did compile and looks good to me, so I've applied it.
Thanks,
Thierry
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
prev parent reply other threads:[~2013-08-27 8:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-23 10:18 [patch 1/2] gpu: host1x: fix an integer overflow check Dan Carpenter
2013-08-27 8:30 ` Thierry Reding [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=20130827083023.GJ8686@ulmo \
--to=thierry.reding@gmail.com \
--cc=dan.carpenter@oracle.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=tbergstrom@nvidia.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox