lkml.org 
[lkml]   [2010]   [Mar]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch] udf: potential integer overflow
On Mon 15-03-10 11:21:13, Dan Carpenter wrote:
> bloc->logicalBlockNum is unsigned so it's never less than zero.
>
> When I saw that, it made me worry that "bloc->logicalBlockNum + count"
> could overflow. That's why I changed the check for less than zero
> to an overflow check. (The test works because "count" is also
> unsigned.)
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
Thanks. Merged.

> ---
> GCC 4.1 apparently optimizes overflow checks like this away, but it should
> work for other versions of gcc. I tested with GCC 4.3.
> http://www.fefe.de/intof.html
It should only optimize them out for signed types (moreover kernel has
this optimization turned off so it's a non-issue for us anyway).

Honza

--
Jan Kara <jack@suse.cz>
SUSE Labs, CR


\
 
 \ /
  Last update: 2010-03-15 13:11    [W:0.286 / U:1.228 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site