lkml.org 
[lkml]   [2016]   [Jul]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] add u64 number parser
From
Date
On 07/22/16 17:23, James Smart wrote:
> + buf = kmalloc(len + 1, GFP_KERNEL);
> + if (!buf)
> + return -ENOMEM;
> + memcpy(buf, s->from, len);
> + buf[len] = '\0';

Hello James,

Have you considered to combine the above kmalloc() and memcpy() calls
into a single kasprintf(GFP_KERNEL, "%.*s", len, s->from) call?

Bart.

\
 
 \ /
  Last update: 2016-07-23 04:21    [W:0.092 / U:0.332 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site