Re: [PATCH] memparse bugfix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/16/05, Chris Wright <[email protected]> wrote:
> * aq ([email protected]) wrote:
> > Function lib/cmdline.c:memparse() wrongly calculates the memory if the
> > given string has K/M/G suffix. This patch (against 2.6.13-rc3) fixes
> > the problem. Please apply.
> 
> Patch looks incorrect.
> 
> > --- 2.6.13-rc3/lib/cmdline.c  2005-04-30 10:31:37.000000000 +0900
> > +++ 2.6.13-rc3/lib/cmdline-aq.c       2005-07-16 02:25:26.000000000 +0900
> > @@ -100,10 +100,10 @@ unsigned long long memparse (char *ptr,
> >       switch (**retptr) {
> >       case 'G':
> >       case 'g':
> > -             ret <<= 10;
> > +             ret <<= 30;
> >       case 'M':
> >       case 'm':
> > -             ret <<= 10;
> > +             ret <<= 20;
> >       case 'K':
> >       case 'k':
> >               ret <<= 10;
> 
> Now, G == ret << 80, M == ret << 30...  Notice the fall-thru cases.
> 

oops, this code doesnt use "break" like normally. what a trap!

sorry for the noise :-)

regards,
aq
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux