[lkml]   [2003]   [Jan]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] fs/partitions/msdos.c Guard against negative sizes
> >             u32 size = NR_SECTS(p)*sector_size;
> > - if (!size)
> > + if (size <= 0)
> But an unsigned variable cannot be negative, so what you write
> is the same as what was there already.
> In other words, your "negative" sizes are just very large positive.
> The test should be whether the partition extends beyond the end
> of the disk, but sometimes that is allowed, even necessary, so
> there could be a warning only.
Sorry, didn't pay enough attention.
On second look: it's an u32.
But that brings the next question up: what about overflow? u32 means a max of
u32 start = START_SECT(p)*sector_size;
u32 size = NR_SECTS(p)*sector_size;
And this looks as if it was calculated in bytes - but I'm sure that 4GB is not
the max size! Where am I wrong??

And btw, when can a partition that extends beyond the end be "allowed or even

Thanks for your answer!



To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:32    [W:0.034 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site