[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20140626204403.d4fadfadbfbba95a319b41f4@skynet.be>
Date: Thu, 26 Jun 2014 20:44:03 +0200
From: Fabian Frederick <fabf@...net.be>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Bob Copeland <me@...copeland.com>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH 1/1] FS/OMFS: block number sanity check during
fill_super operation
On Thu, 26 Jun 2014 11:35:57 -0700
Linus Torvalds <torvalds@...ux-foundation.org> wrote:
> On Jun 26, 2014 11:28 AM, "Fabian Frederick" <fabf@...net.be> wrote:
> >
> > Sorry but I don't see a problem with 2^31 value.
>
> It's not really 2^31.
>
> It's *negative* 2^31.
>
> 1 is "int", so it's a signed number. With the shift it ends up being a
> signed number with the high bit set. That's just a bad bad idea.
>
> Now, it just so happens that if you always compare it with unsigned
> numbers, C promotion rules will end up promoting it to unsigned and it
> happens to *work*, but that is more luck than design.
>
> So I'd suggest using 0x80000000 (which is unsigned) or use (1ul<<31) or
> similar explicit C typing.
Ok, I understand now. Thanks a lot for taking the time to explain Linus.
It really means a lot to me.
Fabian
>
> Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists