Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1793040imm; Thu, 9 Aug 2018 01:58:23 -0700 (PDT) X-Google-Smtp-Source: AA+uWPztvRLyddXyQCNx/zkG1f0ntEL/QLvUryv/Lb5xvirpbXe9x9Ihm2ArIciB58AAfFF1n/Er X-Received: by 2002:a17:902:26c:: with SMTP id 99-v6mr1213139plc.341.1533805103317; Thu, 09 Aug 2018 01:58:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533805103; cv=none; d=google.com; s=arc-20160816; b=XTXO1vKenMqQu7zLBnaiRGMBEanbLI2RLamFiP5LJwTeimn1ahZ6arKDfY7hsZVQYg GwD/RmWKWk27xK3vJTNCscUD0QJN5vgt4QXtp+2tDmzVG215zurj9pprNpaUi+1YCnaM YVVMLlL9mPQi8HIDyc3fHlo8kws3lJGyptKWv3j+wTlSY2c+ezf8tM5Hi13+ICY/XbMo I2hDbeZKZ0EJSRKZZ3EUqHRnOI+DZ5jvYam6FF3kIyVO9J14+Mk/L4qTahlCI8L2iLxy 4/yctHD50ItnCcLbHmqe5SMAitm/yoxv6nGbk/HxPM4r8Zh4iv8h2UbyNSbrQC0s8sqT kodw== 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=pCZ0LrRRX5WCIGqNm5wod9y9Vto6xY9wvS7pDFmREfI=; b=ge+1Yz0LkK1QsHMXaML5Tgj7dE5CSKaNiRK8+Kb0tDYjiQtVrRVeq+bSh5ujj6ufWw QCJnF6az+v4HzRNCBa0ztflOCI5D6Bkm7hf2hfUmVC8R0zN4mIR7qaoJAJU8ArmuDwMr ZwV6A6nuc8IyB2XUCMsHvd5M8MUfbzk5Veu40eaoSNxE5Hbjb7E6jjF/2OiYUH/TT9kD NMG2oeGGgjn0Y8cxDBtfqmM3hDpUSwq/XqgKCuLDDRDZ7tpBkQJi0YkA8MRRn0Z1C1o4 qUQH1sb/j7COSJwVwlL6MbNyN3xrWeqIw6J/+0XfdVvyN8nVyfTgYAqZnM7z5GpLZ9pP 0ePg== 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 r138-v6si7228191pfc.202.2018.08.09.01.58.08; Thu, 09 Aug 2018 01:58:23 -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 S1729393AbeHILVK (ORCPT + 99 others); Thu, 9 Aug 2018 07:21:10 -0400 Received: from proxima.lasnet.de ([78.47.171.185]:46544 "EHLO proxima.lasnet.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727371AbeHILVJ (ORCPT ); Thu, 9 Aug 2018 07:21:09 -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 A71A0C859F; Thu, 9 Aug 2018 10:57:16 +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> <488f54b7-cfe2-f64b-168e-11f79d4d4e96@datenfreihafen.org> From: Stefan Schmidt Message-ID: Date: Thu, 9 Aug 2018 10:57:16 +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: 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 Yue. On 08/09/2018 10:44 AM, YueHaibing wrote: > On 2018/8/9 16:13, Stefan Schmidt wrote: >> 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 > > Well, It should be this, but it's been a long time to use the former Never to late to fix something I guess. :-) Not blocking this patch base on this though. >> 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. > > It just a code cleanup only for ca8210. Thanks for the info. I will wait for Harry's ack and apply it to wpan-next afterwards. regards Stefan Schmidt