Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1363544imm; Thu, 23 Aug 2018 01:37:14 -0700 (PDT) X-Google-Smtp-Source: AA+uWPyAl/afHWEPHgcA9HVEHtHMOyKolbm2vyGXC2C5+SUz/yYFdq547okeazUOlwye6RRvx0O8 X-Received: by 2002:a63:e949:: with SMTP id q9-v6mr54708880pgj.4.1535013434134; Thu, 23 Aug 2018 01:37:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535013434; cv=none; d=google.com; s=arc-20160816; b=WATKr2WT1Cts+9/ev7DQYBXYoGVyvgI3rdTBtQZWKpbv3oE5Xh0QgrO5RJ/BO/PXkl c+W8kFuZ0QiV1XdnIBi38+lQPb7L7jZCYYBai6JKq8Mp6KD+Mp9oly/lDHv7siJJj8EO MEMTXMjp4fb3XnRDUvpt09KSqIgxhByqz/1WxtYExEim6oXatIDpK64EUO3VO+/TGUPK jicSQDendpPaDX4sKrxWe6SlcXuce6AcZrOIEaD7Y/R1MZ9LCkxmVsbWwTS6k0LE2TJf aHDK2GdKcufaAy2uOCR2QOMVnMQLHUB03L7WU6VYT5eMsrXEf9KOh6y5utkv7aIzgRoz 0kxQ== 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=uWM3ic3ljEE+HFh7gSFJbqMKTP7SQLc1xzGWHvb1/Bw=; b=1IQpKI4DrimC1xhM9dWABFVMsafP6RhkOs6l6KVgdjM7wkYe9PV2xtKhZMbmxuS8N+ SwmdlD1oTs3Pnv288wlJcInc2en+RrBSaWnQmm2ltJhwkse8/F9RqtKrQR4O8K0efT16 yfhisNH5jxefgLkEjw9gVQrrFxaqrmsZwJjhA5ea/+TMLzppBtGMvoeKjUvQog3cf0rJ GKc1hLwgNL3qBes4f5IsJ8EadZP9P/6V7JBFdntBkW2iu6Apw/wZuvV9AxKBCosEw/oU 3KuAw4Fkr8CL7TeJ1LKcWkQ1NmdEhinROWWC0TxWL4neM2suB2ZhXicab+OL1uTbbn1D oxrA== 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 31-v6si3758149plg.260.2018.08.23.01.36.58; Thu, 23 Aug 2018 01:37:14 -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 S1731410AbeHWL7m (ORCPT + 99 others); Thu, 23 Aug 2018 07:59:42 -0400 Received: from proxima.lasnet.de ([78.47.171.185]:55772 "EHLO proxima.lasnet.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730897AbeHWL7l (ORCPT ); Thu, 23 Aug 2018 07:59:41 -0400 Received: from [172.18.213.110] (unknown [46.183.103.8]) (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 526E5C86D0; Thu, 23 Aug 2018 10:31:07 +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: Date: Thu, 23 Aug 2018 10:31:04 +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 > --- > 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); > This patch has been applied to the wpan tree and will be part of the next pull request to net. Thanks! regards Stefan Schmidt