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
* 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.

thanks,
-chris
-
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:21    [from the cache]
©2003-2011 Jasper Spaans