lkml.org 
[lkml]   [2005]   [Jul]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] memparse bugfix
On 7/16/05, Chris Wright <chrisw@osdl.org> wrote:
> * aq (aquynh@gmail.com) 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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-07-15 20:33    [W:0.034 / U:0.664 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site