Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1759372imm; Thu, 9 Aug 2018 01:15:06 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxYr8H1aCCo4J3GYuPVKQl5szwj2bzaIFv3Qjd1DGKOnsb1zvt1HDif2RYwfIWITD73ltJ2 X-Received: by 2002:a63:f751:: with SMTP id f17-v6mr1185659pgk.410.1533802506673; Thu, 09 Aug 2018 01:15:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533802506; cv=none; d=google.com; s=arc-20160816; b=BsQs+BJKZQL4MPF4etv0u3gfOiHqj5kzfBhhOL9JbYTOuEiEXIxkVshwVPXRVB4hUg qN1RhGetcYiz5/IdRkaksYYdndIfnCnAv19qOBFHmbxsFN8mrqhoGBdPfZ1XCWYrOCgc FkuCtYJx2nSgBca3FyyaUs3K8+g6KFG4Ft13CB9QA91LrUme7jsfR2pHydoixKDdT1Um 5YliMTHWidedicWbt2K1Np9iIJ999Ha5vJcm/fu+FM7IRUZcDbGeUMaaxJOX0ts2jTsk mChVLTFLSthyZvW/hzkgSQ80wMOGTzk3Bf9IeH89wG0I2BdLzFc9lphT7yqb5+KBX8E4 SDxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=b5+Pyjt5mzxtug4Z/AS1jsJ3p0ZA1H6NMWVLRFZnT38=; b=f+C5vyA2GF7C1MzYZ5TGrS8WqkrdSmSteyFRj56MNpL35/EmYuWXitIGnjm13AAgiv 0jbO9Pri8vsyXFReE14aB5/BNCJZVora4ln/ciodjC4iTP1GoDlXa7qm/oVI5Y4cEoPF Sa8QgkWlrSfhwes1Py3juVctRAsmXrso6kzP7McOdC6uzHv9oJU04XkcAdkNdWeP9Z1t NkHkiH0dXK5vV/y7vzRar3WRj8Q4yBbkQB7PEs/SvpV2VYVy9G7iUixptb50oRAKp/lR xbPFxmBDE521LziX4gszfplgNPmA5gX+0//9cHCF1pIt8jA1oomVVZUVvfWOObsmJHmu 0pjA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o5-v6si5232166pll.449.2018.08.09.01.14.52; Thu, 09 Aug 2018 01:15:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729080AbeHIKhm (ORCPT + 99 others); Thu, 9 Aug 2018 06:37:42 -0400 Received: from proxima.lasnet.de ([78.47.171.185]:46522 "EHLO proxima.lasnet.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727371AbeHIKhm (ORCPT ); Thu, 9 Aug 2018 06:37:42 -0400 Received: from [IPv6:2003:e9:d709:f021:3252:cbff:fe54:190f] (p200300E9D709F0213252CBFFFE54190F.dip0.t-ipconnect.de [IPv6:2003:e9:d709:f021:3252:cbff:fe54:190f]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: stefan@datenfreihafen.org) by proxima.lasnet.de (Postfix) with ESMTPSA id 90B53C859D; Thu, 9 Aug 2018 10:13:58 +0200 (CEST) Subject: Re: [PATCH net-next] ieee802154: Use kmemdup instead of duplicating it in ca8210_test_int_driver_write To: YueHaibing , davem@davemloft.net, h.morris@cascoda.com, alex.aring@gmail.com Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-wpan@vger.kernel.org References: <20180809064429.13348-1-yuehaibing@huawei.com> From: Stefan Schmidt Message-ID: <488f54b7-cfe2-f64b-168e-11f79d4d4e96@datenfreihafen.org> Date: Thu, 9 Aug 2018 10:13:57 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180809064429.13348-1-yuehaibing@huawei.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello. On 08/09/2018 08:44 AM, YueHaibing wrote: > Replace calls to kmalloc followed by a memcpy with a direct call to > kmemdup. > > Signed-off-by: YueHaibing Is Yue your forname and Haibing your surname? In that case having it written as Yue Haibing in the from line as well as in the SOB would be better. > --- > drivers/net/ieee802154/ca8210.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/net/ieee802154/ca8210.c b/drivers/net/ieee802154/ca8210.c > index 58299fb..e21279d 100644 > --- a/drivers/net/ieee802154/ca8210.c > +++ b/drivers/net/ieee802154/ca8210.c > @@ -634,10 +634,9 @@ static int ca8210_test_int_driver_write( > for (i = 0; i < len; i++) > dev_dbg(&priv->spi->dev, "%#03x\n", buf[i]); > > - fifo_buffer = kmalloc(len, GFP_KERNEL); > + fifo_buffer = kmemdup(buf, len, GFP_KERNEL); > if (!fifo_buffer) > return -ENOMEM; > - memcpy(fifo_buffer, buf, len); > kfifo_in(&test->up_fifo, &fifo_buffer, 4); > wake_up_interruptible(&priv->test.readq); Is this some kernel tree wide change you are submitting patches for or only for the ca8210 driver? Is there any specific problem you see with the kmalloc and memcpy code here? To me it looks fine. The reason I ask is to understand if this is bug fix or a cleanup. Harry, if you are ok with this one let me know with an Acked-By regards Stefan Schmidt