All of lore.kernel.org
 help / color / mirror / Atom feed
From: YueHaibing <yuehaibing@huawei.com>
To: Stefan Schmidt <stefan@datenfreihafen.org>, <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>
Subject: Re: [PATCH net-next] ieee802154: Use kmemdup instead of duplicating it in ca8210_test_int_driver_write
Date: Thu, 9 Aug 2018 16:44:32 +0800	[thread overview]
Message-ID: <aaf879dd-c630-a201-b8ae-66c39a359a99@huawei.com> (raw)
In-Reply-To: <488f54b7-cfe2-f64b-168e-11f79d4d4e96@datenfreihafen.org>

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 <yuehaibing@huawei.com>
> 
> Is Yue your forname and Haibing your surname? In that case having it
> written as
> 
> Yue Haibing <yuehaibing@huawei.com>

Well, It should be this, but it's been a long time to use the former

> 
> 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.

> 
> Harry, if you are ok with this one let me know with an Acked-By
> 
> regards
> Stefan Schmidt
> 
> .
> 


WARNING: multiple messages have this Message-ID (diff)
From: YueHaibing <yuehaibing@huawei.com>
To: Stefan Schmidt <stefan@datenfreihafen.org>,
	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
Subject: Re: [PATCH net-next] ieee802154: Use kmemdup instead of duplicating it in ca8210_test_int_driver_write
Date: Thu, 9 Aug 2018 16:44:32 +0800	[thread overview]
Message-ID: <aaf879dd-c630-a201-b8ae-66c39a359a99@huawei.com> (raw)
In-Reply-To: <488f54b7-cfe2-f64b-168e-11f79d4d4e96@datenfreihafen.org>

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 <yuehaibing@huawei.com>
> 
> Is Yue your forname and Haibing your surname? In that case having it
> written as
> 
> Yue Haibing <yuehaibing@huawei.com>

Well, It should be this, but it's been a long time to use the former

> 
> 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.

> 
> Harry, if you are ok with this one let me know with an Acked-By
> 
> regards
> Stefan Schmidt
> 
> .
> 


  reply	other threads:[~2018-08-09  8:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-09  6:44 [PATCH net-next] ieee802154: Use kmemdup instead of duplicating it in ca8210_test_int_driver_write YueHaibing
2018-08-09  6:44 ` YueHaibing
2018-08-09  8:13 ` Stefan Schmidt
2018-08-09  8:44   ` YueHaibing [this message]
2018-08-09  8:44     ` YueHaibing
2018-08-09  8:57     ` Stefan Schmidt
2018-08-23  8:31 ` Stefan Schmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aaf879dd-c630-a201-b8ae-66c39a359a99@huawei.com \
    --to=yuehaibing@huawei.com \
    --cc=alex.aring@gmail.com \
    --cc=davem@davemloft.net \
    --cc=h.morris@cascoda.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wpan@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stefan@datenfreihafen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.