From: Eric Biggers <ebiggers@kernel.org>
To: linux-kernel@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] lib/parser.c: switch match_number() over to use match_strdup()
Date: Tue, 4 Sep 2018 18:39:16 -0700 [thread overview]
Message-ID: <20180905013915.GA1928@sol.localdomain> (raw)
In-Reply-To: <20180830194727.191555-1-ebiggers@kernel.org>
On Thu, Aug 30, 2018 at 12:47:27PM -0700, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
>
> This simplifies the code. No change in behavior.
>
> Signed-off-by: Eric Biggers <ebiggers@google.com>
> ---
> lib/parser.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/lib/parser.c b/lib/parser.c
> index 0142ef28f0eb..96656a6dd59b 100644
> --- a/lib/parser.c
> +++ b/lib/parser.c
> @@ -131,13 +131,10 @@ static int match_number(substring_t *s, int *result, int base)
> char *buf;
> int ret;
> long val;
> - size_t len = s->to - s->from;
>
> - buf = kmalloc(len + 1, GFP_KERNEL);
> + buf = match_strdup(s);
> if (!buf)
> return -ENOMEM;
> - memcpy(buf, s->from, len);
> - buf[len] = '\0';
>
> ret = 0;
> val = simple_strtol(buf, &endp, base);
> --
Hi Andrew, are you planning to take this patch too? The similar patch
lib/parser.c: switch match_u64int() over to use match_strdup()
is in -mm now, but this one is not.
Thanks,
- Eric
prev parent reply other threads:[~2018-09-05 1:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-30 19:47 [PATCH] lib/parser.c: switch match_number() over to use match_strdup() Eric Biggers
2018-09-05 1:39 ` Eric Biggers [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=20180905013915.GA1928@sol.localdomain \
--to=ebiggers@kernel.org \
--cc=akpm@linux-foundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox