* [PATCH net-next] ethernet: ucc_geth: Use kmemdup() rather than kmalloc+memcpy
@ 2021-05-23 7:56 ` YueHaibing
0 siblings, 0 replies; 8+ messages in thread
From: YueHaibing @ 2021-05-23 7:56 UTC (permalink / raw)
To: leoyang.li, davem, kuba, rasmus.villemoes
Cc: netdev, linuxppc-dev, linux-kernel, YueHaibing
Issue identified with Coccinelle.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/net/ethernet/freescale/ucc_geth.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c
index e0936510fa34..51206272cc25 100644
--- a/drivers/net/ethernet/freescale/ucc_geth.c
+++ b/drivers/net/ethernet/freescale/ucc_geth.c
@@ -3590,10 +3590,10 @@ static int ucc_geth_probe(struct platform_device* ofdev)
if ((ucc_num < 0) || (ucc_num > 7))
return -ENODEV;
- ug_info = kmalloc(sizeof(*ug_info), GFP_KERNEL);
+ ug_info = kmemdup(&ugeth_primary_info, sizeof(*ug_info),
+ GFP_KERNEL);
if (ug_info == NULL)
return -ENOMEM;
- memcpy(ug_info, &ugeth_primary_info, sizeof(*ug_info));
ug_info->uf_info.ucc_num = ucc_num;
--
2.17.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH net-next] ethernet: ucc_geth: Use kmemdup() rather than kmalloc+memcpy
@ 2021-05-23 7:56 ` YueHaibing
0 siblings, 0 replies; 8+ messages in thread
From: YueHaibing @ 2021-05-23 7:56 UTC (permalink / raw)
To: leoyang.li, davem, kuba, rasmus.villemoes
Cc: netdev, YueHaibing, linuxppc-dev, linux-kernel
Issue identified with Coccinelle.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/net/ethernet/freescale/ucc_geth.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c
index e0936510fa34..51206272cc25 100644
--- a/drivers/net/ethernet/freescale/ucc_geth.c
+++ b/drivers/net/ethernet/freescale/ucc_geth.c
@@ -3590,10 +3590,10 @@ static int ucc_geth_probe(struct platform_device* ofdev)
if ((ucc_num < 0) || (ucc_num > 7))
return -ENODEV;
- ug_info = kmalloc(sizeof(*ug_info), GFP_KERNEL);
+ ug_info = kmemdup(&ugeth_primary_info, sizeof(*ug_info),
+ GFP_KERNEL);
if (ug_info == NULL)
return -ENOMEM;
- memcpy(ug_info, &ugeth_primary_info, sizeof(*ug_info));
ug_info->uf_info.ucc_num = ucc_num;
--
2.17.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH net-next] ethernet: ucc_geth: Use kmemdup() rather than kmalloc+memcpy
2021-05-23 7:56 ` YueHaibing
@ 2021-05-23 13:29 ` Christophe Leroy
-1 siblings, 0 replies; 8+ messages in thread
From: Christophe Leroy @ 2021-05-23 13:29 UTC (permalink / raw)
To: YueHaibing
Cc: linux-kernel, linuxppc-dev, netdev, rasmus.villemoes, kuba,
davem, leoyang.li
YueHaibing <yuehaibing@huawei.com> a écrit :
> Issue identified with Coccinelle.
>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
> drivers/net/ethernet/freescale/ucc_geth.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/ucc_geth.c
> b/drivers/net/ethernet/freescale/ucc_geth.c
> index e0936510fa34..51206272cc25 100644
> --- a/drivers/net/ethernet/freescale/ucc_geth.c
> +++ b/drivers/net/ethernet/freescale/ucc_geth.c
> @@ -3590,10 +3590,10 @@ static int ucc_geth_probe(struct
> platform_device* ofdev)
> if ((ucc_num < 0) || (ucc_num > 7))
> return -ENODEV;
>
> - ug_info = kmalloc(sizeof(*ug_info), GFP_KERNEL);
> + ug_info = kmemdup(&ugeth_primary_info, sizeof(*ug_info),
> + GFP_KERNEL);
Can you keep that as a single line ? The tolerance is 100 chars per line now.
> if (ug_info == NULL)
> return -ENOMEM;
> - memcpy(ug_info, &ugeth_primary_info, sizeof(*ug_info));
>
> ug_info->uf_info.ucc_num = ucc_num;
>
> --
> 2.17.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next] ethernet: ucc_geth: Use kmemdup() rather than kmalloc+memcpy
@ 2021-05-23 13:29 ` Christophe Leroy
0 siblings, 0 replies; 8+ messages in thread
From: Christophe Leroy @ 2021-05-23 13:29 UTC (permalink / raw)
To: YueHaibing
Cc: rasmus.villemoes, netdev, linux-kernel, leoyang.li, kuba,
linuxppc-dev, davem
YueHaibing <yuehaibing@huawei.com> a écrit :
> Issue identified with Coccinelle.
>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
> drivers/net/ethernet/freescale/ucc_geth.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/ucc_geth.c
> b/drivers/net/ethernet/freescale/ucc_geth.c
> index e0936510fa34..51206272cc25 100644
> --- a/drivers/net/ethernet/freescale/ucc_geth.c
> +++ b/drivers/net/ethernet/freescale/ucc_geth.c
> @@ -3590,10 +3590,10 @@ static int ucc_geth_probe(struct
> platform_device* ofdev)
> if ((ucc_num < 0) || (ucc_num > 7))
> return -ENODEV;
>
> - ug_info = kmalloc(sizeof(*ug_info), GFP_KERNEL);
> + ug_info = kmemdup(&ugeth_primary_info, sizeof(*ug_info),
> + GFP_KERNEL);
Can you keep that as a single line ? The tolerance is 100 chars per line now.
> if (ug_info == NULL)
> return -ENOMEM;
> - memcpy(ug_info, &ugeth_primary_info, sizeof(*ug_info));
>
> ug_info->uf_info.ucc_num = ucc_num;
>
> --
> 2.17.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next] ethernet: ucc_geth: Use kmemdup() rather than kmalloc+memcpy
2021-05-23 13:29 ` Christophe Leroy
@ 2021-05-23 14:26 ` Andrew Lunn
-1 siblings, 0 replies; 8+ messages in thread
From: Andrew Lunn @ 2021-05-23 14:26 UTC (permalink / raw)
To: Christophe Leroy
Cc: YueHaibing, linux-kernel, linuxppc-dev, netdev, rasmus.villemoes,
kuba, davem, leoyang.li
On Sun, May 23, 2021 at 03:29:37PM +0200, Christophe Leroy wrote:
> YueHaibing <yuehaibing@huawei.com> a écrit :
>
> > Issue identified with Coccinelle.
> >
> > Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> > ---
> > drivers/net/ethernet/freescale/ucc_geth.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/freescale/ucc_geth.c
> > b/drivers/net/ethernet/freescale/ucc_geth.c
> > index e0936510fa34..51206272cc25 100644
> > --- a/drivers/net/ethernet/freescale/ucc_geth.c
> > +++ b/drivers/net/ethernet/freescale/ucc_geth.c
> > @@ -3590,10 +3590,10 @@ static int ucc_geth_probe(struct
> > platform_device* ofdev)
> > if ((ucc_num < 0) || (ucc_num > 7))
> > return -ENODEV;
> >
> > - ug_info = kmalloc(sizeof(*ug_info), GFP_KERNEL);
> > + ug_info = kmemdup(&ugeth_primary_info, sizeof(*ug_info),
> > + GFP_KERNEL);
>
> Can you keep that as a single line ? The tolerance is 100 chars per line now.
Networking prefers 80. If it fits a single 80 char line, please use a single line.
Otherwise please leave it as it is.
Andrew
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next] ethernet: ucc_geth: Use kmemdup() rather than kmalloc+memcpy
@ 2021-05-23 14:26 ` Andrew Lunn
0 siblings, 0 replies; 8+ messages in thread
From: Andrew Lunn @ 2021-05-23 14:26 UTC (permalink / raw)
To: Christophe Leroy
Cc: rasmus.villemoes, netdev, YueHaibing, linux-kernel, leoyang.li,
kuba, linuxppc-dev, davem
On Sun, May 23, 2021 at 03:29:37PM +0200, Christophe Leroy wrote:
> YueHaibing <yuehaibing@huawei.com> a écrit :
>
> > Issue identified with Coccinelle.
> >
> > Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> > ---
> > drivers/net/ethernet/freescale/ucc_geth.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/freescale/ucc_geth.c
> > b/drivers/net/ethernet/freescale/ucc_geth.c
> > index e0936510fa34..51206272cc25 100644
> > --- a/drivers/net/ethernet/freescale/ucc_geth.c
> > +++ b/drivers/net/ethernet/freescale/ucc_geth.c
> > @@ -3590,10 +3590,10 @@ static int ucc_geth_probe(struct
> > platform_device* ofdev)
> > if ((ucc_num < 0) || (ucc_num > 7))
> > return -ENODEV;
> >
> > - ug_info = kmalloc(sizeof(*ug_info), GFP_KERNEL);
> > + ug_info = kmemdup(&ugeth_primary_info, sizeof(*ug_info),
> > + GFP_KERNEL);
>
> Can you keep that as a single line ? The tolerance is 100 chars per line now.
Networking prefers 80. If it fits a single 80 char line, please use a single line.
Otherwise please leave it as it is.
Andrew
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next] ethernet: ucc_geth: Use kmemdup() rather than kmalloc+memcpy
2021-05-23 14:26 ` Andrew Lunn
@ 2021-05-24 1:07 ` YueHaibing
-1 siblings, 0 replies; 8+ messages in thread
From: YueHaibing @ 2021-05-24 1:07 UTC (permalink / raw)
To: Andrew Lunn, Christophe Leroy
Cc: linux-kernel, linuxppc-dev, netdev, rasmus.villemoes, kuba,
davem, leoyang.li
On 2021/5/23 22:26, Andrew Lunn wrote:
> On Sun, May 23, 2021 at 03:29:37PM +0200, Christophe Leroy wrote:
>> YueHaibing <yuehaibing@huawei.com> a écrit :
>>
>>> Issue identified with Coccinelle.
>>>
>>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
>>> ---
>>> drivers/net/ethernet/freescale/ucc_geth.c | 4 ++--
>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/net/ethernet/freescale/ucc_geth.c
>>> b/drivers/net/ethernet/freescale/ucc_geth.c
>>> index e0936510fa34..51206272cc25 100644
>>> --- a/drivers/net/ethernet/freescale/ucc_geth.c
>>> +++ b/drivers/net/ethernet/freescale/ucc_geth.c
>>> @@ -3590,10 +3590,10 @@ static int ucc_geth_probe(struct
>>> platform_device* ofdev)
>>> if ((ucc_num < 0) || (ucc_num > 7))
>>> return -ENODEV;
>>>
>>> - ug_info = kmalloc(sizeof(*ug_info), GFP_KERNEL);
>>> + ug_info = kmemdup(&ugeth_primary_info, sizeof(*ug_info),
>>> + GFP_KERNEL);
>>
>> Can you keep that as a single line ? The tolerance is 100 chars per line now.
>
> Networking prefers 80. If it fits a single 80 char line, please use a single line.
> Otherwise please leave it as it is.
Ok, will send v2.
>
> Andrew
> .
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH net-next] ethernet: ucc_geth: Use kmemdup() rather than kmalloc+memcpy
@ 2021-05-24 1:07 ` YueHaibing
0 siblings, 0 replies; 8+ messages in thread
From: YueHaibing @ 2021-05-24 1:07 UTC (permalink / raw)
To: Andrew Lunn, Christophe Leroy
Cc: rasmus.villemoes, netdev, linux-kernel, leoyang.li, kuba,
linuxppc-dev, davem
On 2021/5/23 22:26, Andrew Lunn wrote:
> On Sun, May 23, 2021 at 03:29:37PM +0200, Christophe Leroy wrote:
>> YueHaibing <yuehaibing@huawei.com> a écrit :
>>
>>> Issue identified with Coccinelle.
>>>
>>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
>>> ---
>>> drivers/net/ethernet/freescale/ucc_geth.c | 4 ++--
>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/net/ethernet/freescale/ucc_geth.c
>>> b/drivers/net/ethernet/freescale/ucc_geth.c
>>> index e0936510fa34..51206272cc25 100644
>>> --- a/drivers/net/ethernet/freescale/ucc_geth.c
>>> +++ b/drivers/net/ethernet/freescale/ucc_geth.c
>>> @@ -3590,10 +3590,10 @@ static int ucc_geth_probe(struct
>>> platform_device* ofdev)
>>> if ((ucc_num < 0) || (ucc_num > 7))
>>> return -ENODEV;
>>>
>>> - ug_info = kmalloc(sizeof(*ug_info), GFP_KERNEL);
>>> + ug_info = kmemdup(&ugeth_primary_info, sizeof(*ug_info),
>>> + GFP_KERNEL);
>>
>> Can you keep that as a single line ? The tolerance is 100 chars per line now.
>
> Networking prefers 80. If it fits a single 80 char line, please use a single line.
> Otherwise please leave it as it is.
Ok, will send v2.
>
> Andrew
> .
>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-05-24 1:08 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-23 7:56 [PATCH net-next] ethernet: ucc_geth: Use kmemdup() rather than kmalloc+memcpy YueHaibing
2021-05-23 7:56 ` YueHaibing
2021-05-23 13:29 ` Christophe Leroy
2021-05-23 13:29 ` Christophe Leroy
2021-05-23 14:26 ` Andrew Lunn
2021-05-23 14:26 ` Andrew Lunn
2021-05-24 1:07 ` YueHaibing
2021-05-24 1:07 ` YueHaibing
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.