Thread (4 messages) 4 messages, 3 authors, 2016-08-11

[PATCH] add u64 number parser

From: hch@infradead.org (Christoph Hellwig)
Date: 2016-08-11 21:03:10
Also in: linux-scsi, lkml

On Sat, Jul 23, 2016@08:52:18AM -0700, James Smart wrote:
On 7/22/2016 6:32 PM, Bart Van Assche wrote:
quoted
On 07/22/16 17:23, James Smart wrote:
quoted
+    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.
No, I followed the example of existing parse functions in the file.
The kasprintf would indeed be nicer, but I'm fine with keeping the
existing style for this patch.  Bonus points for sending a follow on
to convert all of them over.

Reviewed-by: Christoph Hellwig <hch at lst.de>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help