From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932203AbcHKVDK (ORCPT ); Thu, 11 Aug 2016 17:03:10 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:46251 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752305AbcHKVDI (ORCPT ); Thu, 11 Aug 2016 17:03:08 -0400 Date: Thu, 11 Aug 2016 14:02:46 -0700 From: Christoph Hellwig To: James Smart Cc: Bart Van Assche , linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org Subject: Re: [PATCH] add u64 number parser Message-ID: <20160811210246.GC18013@infradead.org> References: <5792b919.0C1gyf+dF4XKu6Zj%james.smart@broadcom.com> <5e325cbb-a140-8f26-7402-5dc1a2cd07ea@sandisk.com> <09649a75-e9a1-11d7-37e2-48f4e93a3b2e@broadcom.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <09649a75-e9a1-11d7-37e2-48f4e93a3b2e@broadcom.com> User-Agent: Mutt/1.6.1 (2016-04-27) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jul 23, 2016 at 08:52:18AM -0700, James Smart wrote: > > On 7/22/2016 6:32 PM, Bart Van Assche wrote: > > 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. > > > > 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