On Thu, Aug 30, 2018 at 12:47:27PM -0700, Eric Biggers wrote:
> From: Eric Biggers <ebigg...@google.com>
> 
> This simplifies the code.  No change in behavior.
> 
> Signed-off-by: Eric Biggers <ebigg...@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

Reply via email to