Messages in this thread | | | Date | Thu, 26 Jun 2014 20:44:03 +0200 | From | Fabian Frederick <> | 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@linux-foundation.org> wrote:
> On Jun 26, 2014 11:28 AM, "Fabian Frederick" <fabf@skynet.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
| |