public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] staging: ozwpan: fix memcmp() test in oz_set_active_pd()
@ 2012-08-18  8:47 Dan Carpenter
  2012-08-19 12:15 ` Rupesh Gujare
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Dan Carpenter @ 2012-08-18  8:47 UTC (permalink / raw)
  To: kernel-janitors

"addr" is a pointer so it's either 4 or 8 bytes, but actually we want
to compare 6 bytes (ETH_ALEN).

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/staging/ozwpan/ozcdev.c b/drivers/staging/ozwpan/ozcdev.c
index d983219..63c1b67 100644
--- a/drivers/staging/ozwpan/ozcdev.c
+++ b/drivers/staging/ozwpan/ozcdev.c
@@ -213,7 +213,7 @@ static int oz_set_active_pd(u8 *addr)
 		if (old_pd)
 			oz_pd_put(old_pd);
 	} else {
-		if (!memcmp(addr, "\0\0\0\0\0\0", sizeof(addr))) {
+		if (!memcmp(addr, "\0\0\0\0\0\0", ETH_ALEN)) {
 			spin_lock_bh(&g_cdev.lock);
 			pd = g_cdev.active_pd;
 			g_cdev.active_pd = 0;

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [patch] staging: ozwpan: fix memcmp() test in oz_set_active_pd()
  2012-08-18  8:47 [patch] staging: ozwpan: fix memcmp() test in oz_set_active_pd() Dan Carpenter
@ 2012-08-19 12:15 ` Rupesh Gujare
  2012-08-19 12:37 ` Tomas Winkler
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Rupesh Gujare @ 2012-08-19 12:15 UTC (permalink / raw)
  To: kernel-janitors

On 18/08/12 09:47, Dan Carpenter wrote:
> "addr" is a pointer so it's either 4 or 8 bytes, but actually we want
> to compare 6 bytes (ETH_ALEN).
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Rupesh Gujare<rgujare@ozmodevices.com>


> diff --git a/drivers/staging/ozwpan/ozcdev.c b/drivers/staging/ozwpan/ozcdev.c
> index d983219..63c1b67 100644
> --- a/drivers/staging/ozwpan/ozcdev.c
> +++ b/drivers/staging/ozwpan/ozcdev.c
> @@ -213,7 +213,7 @@ static int oz_set_active_pd(u8 *addr)
>   		if (old_pd)
>   			oz_pd_put(old_pd);
>   	} else {
> -		if (!memcmp(addr, "\0\0\0\0\0\0", sizeof(addr))) {
> +		if (!memcmp(addr, "\0\0\0\0\0\0", ETH_ALEN)) {
>   			spin_lock_bh(&g_cdev.lock);
>   			pd = g_cdev.active_pd;
>   			g_cdev.active_pd = 0;
>


-- 
Regards,
Rupesh Gujare



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] staging: ozwpan: fix memcmp() test in oz_set_active_pd()
  2012-08-18  8:47 [patch] staging: ozwpan: fix memcmp() test in oz_set_active_pd() Dan Carpenter
  2012-08-19 12:15 ` Rupesh Gujare
@ 2012-08-19 12:37 ` Tomas Winkler
  2012-08-19 13:06 ` Rupesh Gujare
  2012-08-19 22:23 ` Dan Carpenter
  3 siblings, 0 replies; 5+ messages in thread
From: Tomas Winkler @ 2012-08-19 12:37 UTC (permalink / raw)
  To: kernel-janitors

> On 18/08/12 09:47, Dan Carpenter wrote:
>>
>> "addr" is a pointer so it's either 4 or 8 bytes, but actually we want
>> to compare 6 bytes (ETH_ALEN).
>>
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
>
> Acked-by: Rupesh Gujare<rgujare@ozmodevices.com>

why not to use 'if (is_zero_ether_addr())" from linux/etherdevice.h
Thanks
Tomas


>
>
>
>> diff --git a/drivers/staging/ozwpan/ozcdev.c
>> b/drivers/staging/ozwpan/ozcdev.c
>> index d983219..63c1b67 100644
>> --- a/drivers/staging/ozwpan/ozcdev.c
>> +++ b/drivers/staging/ozwpan/ozcdev.c
>> @@ -213,7 +213,7 @@ static int oz_set_active_pd(u8 *addr)
>>                 if (old_pd)
>>                         oz_pd_put(old_pd);
>>         } else {
>> -               if (!memcmp(addr, "\0\0\0\0\0\0", sizeof(addr))) {
>> +               if (!memcmp(addr, "\0\0\0\0\0\0", ETH_ALEN)) {
>>                         spin_lock_bh(&g_cdev.lock);
>>                         pd = g_cdev.active_pd;
>>                         g_cdev.active_pd = 0;
>>
>
>
> --
> Regards,
> Rupesh Gujare
>
>
>
> _______________________________________________
> devel mailing list
> devel@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] staging: ozwpan: fix memcmp() test in oz_set_active_pd()
  2012-08-18  8:47 [patch] staging: ozwpan: fix memcmp() test in oz_set_active_pd() Dan Carpenter
  2012-08-19 12:15 ` Rupesh Gujare
  2012-08-19 12:37 ` Tomas Winkler
@ 2012-08-19 13:06 ` Rupesh Gujare
  2012-08-19 22:23 ` Dan Carpenter
  3 siblings, 0 replies; 5+ messages in thread
From: Rupesh Gujare @ 2012-08-19 13:06 UTC (permalink / raw)
  To: kernel-janitors

On 19/08/12 13:37, Tomas Winkler wrote:
>> On 18/08/12 09:47, Dan Carpenter wrote:
>>> "addr" is a pointer so it's either 4 or 8 bytes, but actually we want
>>> to compare 6 bytes (ETH_ALEN).
>>>
>>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>>
>> Acked-by: Rupesh Gujare<rgujare@ozmodevices.com>
> why not to use 'if (is_zero_ether_addr())" from linux/etherdevice.h
>
Tom,

Thanks for pointing this out, that looks more efficient. Interested in 
submitting a patch ?

Dan,

What do you think ?


-- 
Regards,
Rupesh Gujare





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [patch] staging: ozwpan: fix memcmp() test in oz_set_active_pd()
  2012-08-18  8:47 [patch] staging: ozwpan: fix memcmp() test in oz_set_active_pd() Dan Carpenter
                   ` (2 preceding siblings ...)
  2012-08-19 13:06 ` Rupesh Gujare
@ 2012-08-19 22:23 ` Dan Carpenter
  3 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2012-08-19 22:23 UTC (permalink / raw)
  To: kernel-janitors

On 8/19/12, Rupesh Gujare <rgujare@ozmodevices.com> wrote:
> On 19/08/12 13:37, Tomas Winkler wrote:
>>> On 18/08/12 09:47, Dan Carpenter wrote:
>>>> "addr" is a pointer so it's either 4 or 8 bytes, but actually we want
>>>> to compare 6 bytes (ETH_ALEN).
>>>>
>>>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>>>
>>> Acked-by: Rupesh Gujare<rgujare@ozmodevices.com>
>> why not to use 'if (is_zero_ether_addr())" from linux/etherdevice.h
>>
> Tom,
>
> Thanks for pointing this out, that looks more efficient. Interested in
> submitting a patch ?
>
> Dan,
>
> What do you think ?
>

Yes yes.  Of course.  It's the weekend and I'm traveling but I can redo this.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-08-19 22:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-18  8:47 [patch] staging: ozwpan: fix memcmp() test in oz_set_active_pd() Dan Carpenter
2012-08-19 12:15 ` Rupesh Gujare
2012-08-19 12:37 ` Tomas Winkler
2012-08-19 13:06 ` Rupesh Gujare
2012-08-19 22:23 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox