From: aq <aquynh@gmail.com>
To: Chris Wright <chrisw@osdl.org>
Cc: lkml <linux-kernel@vger.kernel.org>, Andrew Morton <akpm@osdl.org>
Subject: Re: [PATCH] memparse bugfix
Date: Sat, 16 Jul 2005 03:29:39 +0900 [thread overview]
Message-ID: <9cde8bff05071511293bef5908@mail.gmail.com> (raw)
In-Reply-To: <20050715181250.GO9153@shell0.pdx.osdl.net>
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
prev parent reply other threads:[~2005-07-15 18:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-15 17:30 [PATCH] memparse bugfix aq
2005-07-15 18:12 ` Chris Wright
2005-07-15 18:29 ` aq [this message]
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=9cde8bff05071511293bef5908@mail.gmail.com \
--to=aquynh@gmail.com \
--cc=akpm@osdl.org \
--cc=chrisw@osdl.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.