mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chris Wright <chrisw@osdl.org>
To: aq <aquynh@gmail.com>
Cc: lkml <linux-kernel@vger.kernel.org>, Andrew Morton <akpm@osdl.org>
Subject: Re: [PATCH] memparse bugfix
Date: Fri, 15 Jul 2005 11:12:50 -0700	[thread overview]
Message-ID: <20050715181250.GO9153@shell0.pdx.osdl.net> (raw)
In-Reply-To: <9cde8bff05071510307c7beb4@mail.gmail.com>

* 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

  reply	other threads:[~2005-07-15 18:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-15 17:30 aq
2005-07-15 18:12 ` Chris Wright [this message]
2005-07-15 18:29   ` aq

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050715181250.GO9153@shell0.pdx.osdl.net \
    --to=chrisw@osdl.org \
    --cc=akpm@osdl.org \
    --cc=aquynh@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®