Re: [PATCH] memparse bugfix

From: Chris Wright
Date: Fri Jul 15 2005 - 13:18:54 EST


* aq (aquynh@xxxxxxxxx) 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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/