mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -next] qlcnic: fix compiler warning
@ 2014-01-09 15:59 Martin Kaiser
  2014-01-10  7:19 ` Shahed Shaikh
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Kaiser @ 2014-01-09 15:59 UTC (permalink / raw)
  To: Himanshu Madhani, Rajesh Borundia; +Cc: linux-kernel, trivial

Add an explicit cast to fix the following warning
(seen on Debian Wheezy, gcc 4.7.2)

CC [M]  drivers/net/wireless/rtlwifi/rtl8192ce/trx.o
    drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c: In function ‘qlcnic_send_filter’:
    drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c:349:3: warning:
    passing argument 2 of ‘ether_addr_equal’ from incompatible pointer type [enabled by default]
    In file included from include/linux/if_vlan.h:16:0,
    from drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c:9:
    include/linux/etherdevice.h:244:20: note: expected ‘const u8 *’ but argument is of type ‘u64 *’

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
index 6373f60..3557154 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
@@ -346,7 +346,7 @@ static void qlcnic_send_filter(struct qlcnic_adapter *adapter,
 	head = &(adapter->fhash.fhead[hindex]);
 
 	hlist_for_each_entry_safe(tmp_fil, n, head, fnode) {
-		if (ether_addr_equal(tmp_fil->faddr, &src_addr) &&
+		if (ether_addr_equal(tmp_fil->faddr, (const u8 *)&src_addr) &&
 		    tmp_fil->vlan_id == vlan_id) {
 			if (jiffies > (QLCNIC_READD_AGE * HZ + tmp_fil->ftime))
 				qlcnic_change_filter(adapter, &src_addr,
-- 
1.7.10.4


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

* RE: [PATCH -next] qlcnic: fix compiler warning
  2014-01-09 15:59 [PATCH -next] qlcnic: fix compiler warning Martin Kaiser
@ 2014-01-10  7:19 ` Shahed Shaikh
  2014-01-10 10:15   ` David Laight
  2014-01-13 22:46   ` David Miller
  0 siblings, 2 replies; 6+ messages in thread
From: Shahed Shaikh @ 2014-01-10  7:19 UTC (permalink / raw)
  To: Martin Kaiser, Himanshu Madhani, Rajesh Borundia
  Cc: linux-kernel, trivial, netdev

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2170 bytes --]


Adding netdev.

> -----Original Message-----
> From: Martin Kaiser,,, [mailto:martin@reykholt.kaiser.cx] On Behalf Of
> Martin Kaiser
> Sent: Thursday, January 09, 2014 9:29 PM
> To: Himanshu Madhani; Rajesh Borundia
> Cc: linux-kernel; trivial@kernel.org
> Subject: [PATCH -next] qlcnic: fix compiler warning
> 
> Add an explicit cast to fix the following warning (seen on Debian Wheezy, gcc
> 4.7.2)
> 
> CC [M]  drivers/net/wireless/rtlwifi/rtl8192ce/trx.o
>     drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c: In function
> ‘qlcnic_send_filter’:
>     drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c:349:3: warning:
>     passing argument 2 of ‘ether_addr_equal’ from incompatible pointer type
> [enabled by default]
>     In file included from include/linux/if_vlan.h:16:0,
>     from drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c:9:
>     include/linux/etherdevice.h:244:20: note: expected ‘const u8 *’ but
> argument is of type ‘u64 *’
>

If I am not wrong, this patch should go to David's net-next tree.
 
> Signed-off-by: Martin Kaiser <martin@kaiser.cx>

Acked-by: Shahed Shaikh <shahed.shaikh@qlogic.com>

Thanks,
Shahed
> ---
>  drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
> b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
> index 6373f60..3557154 100644
> --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
> +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
> @@ -346,7 +346,7 @@ static void qlcnic_send_filter(struct qlcnic_adapter
> *adapter,
>  	head = &(adapter->fhash.fhead[hindex]);
> 
>  	hlist_for_each_entry_safe(tmp_fil, n, head, fnode) {
> -		if (ether_addr_equal(tmp_fil->faddr, &src_addr) &&
> +		if (ether_addr_equal(tmp_fil->faddr, (const u8 *)&src_addr)
> &&
>  		    tmp_fil->vlan_id == vlan_id) {
>  			if (jiffies > (QLCNIC_READD_AGE * HZ + tmp_fil-
> >ftime))
>  				qlcnic_change_filter(adapter, &src_addr,
> --
> 1.7.10.4


ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* RE: [PATCH -next] qlcnic: fix compiler warning
  2014-01-10  7:19 ` Shahed Shaikh
@ 2014-01-10 10:15   ` David Laight
  2014-01-13 22:46   ` David Miller
  1 sibling, 0 replies; 6+ messages in thread
From: David Laight @ 2014-01-10 10:15 UTC (permalink / raw)
  To: 'Shahed Shaikh',
	Martin Kaiser, Himanshu Madhani, Rajesh Borundia
  Cc: linux-kernel, trivial, netdev

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2805 bytes --]

From: Shahed Shaikh
> Adding netdev.
> 
> > -----Original Message-----
> > From: Martin Kaiser,,, [mailto:martin@reykholt.kaiser.cx] On Behalf Of
> > Martin Kaiser
> > Sent: Thursday, January 09, 2014 9:29 PM
> > To: Himanshu Madhani; Rajesh Borundia
> > Cc: linux-kernel; trivial@kernel.org
> > Subject: [PATCH -next] qlcnic: fix compiler warning
> >
> > Add an explicit cast to fix the following warning (seen on Debian Wheezy, gcc
> > 4.7.2)
> >
> > CC [M]  drivers/net/wireless/rtlwifi/rtl8192ce/trx.o
> >     drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c: In function
> > qlcnic_send_filter:
> >     drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c:349:3: warning:
> >     passing argument 2 of ether_addr_equal from incompatible pointer type
> > [enabled by default]
> >     In file included from include/linux/if_vlan.h:16:0,
> >     from drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c:9:
> >     include/linux/etherdevice.h:244:20: note: expected const u8 * but
> > argument is of type u64 *
> >
> 
> If I am not wrong, this patch should go to David's net-next tree.
> 
> > Signed-off-by: Martin Kaiser <martin@kaiser.cx>
> 
> Acked-by: Shahed Shaikh <shahed.shaikh@qlogic.com>
> 
> Thanks,
> Shahed
> > ---
> >  drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
> > b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
> > index 6373f60..3557154 100644
> > --- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
> > +++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
> > @@ -346,7 +346,7 @@ static void qlcnic_send_filter(struct qlcnic_adapter
> > *adapter,
> >  	head = &(adapter->fhash.fhead[hindex]);
> >
> >  	hlist_for_each_entry_safe(tmp_fil, n, head, fnode) {
> > -		if (ether_addr_equal(tmp_fil->faddr, &src_addr) &&
> > +		if (ether_addr_equal(tmp_fil->faddr, (const u8 *)&src_addr)
> > &&
> >  		    tmp_fil->vlan_id == vlan_id) {
> >  			if (jiffies > (QLCNIC_READD_AGE * HZ + tmp_fil-
> > >ftime))
> >  				qlcnic_change_filter(adapter, &src_addr,
> > --
> > 1.7.10.4

A quick look at the code seems to imply that this code is somewhat buggy.
'src_addr' is defined a u64 even though it is a 6 byte mac address.
On big-endian systems the wrong bytes get accessed all over the place.

Also when ether_addr_equal() in inlined the code ends up accessing src_addr
as 32bit and 16bit data - which don't have to be synchronised against
and writes to the 64bit item.

If might be that ether_addr_equal() (etc) should have a gcc asm
statement with a "memory" constraint against the mac address buffers.

	David

ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* Re: [PATCH -next] qlcnic: fix compiler warning
  2014-01-10  7:19 ` Shahed Shaikh
  2014-01-10 10:15   ` David Laight
@ 2014-01-13 22:46   ` David Miller
  1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2014-01-13 22:46 UTC (permalink / raw)
  To: shahed.shaikh
  Cc: martin, himanshu.madhani, rajesh.borundia, linux-kernel, trivial, netdev

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: Text/Plain; charset=iso-8859-7, Size: 1514 bytes --]

From: Shahed Shaikh <shahed.shaikh@qlogic.com>
Date: Fri, 10 Jan 2014 07:19:19 +0000

> 
> Adding netdev.
> 
>> -----Original Message-----
>> From: Martin Kaiser,,, [mailto:martin@reykholt.kaiser.cx] On Behalf Of
>> Martin Kaiser
>> Sent: Thursday, January 09, 2014 9:29 PM
>> To: Himanshu Madhani; Rajesh Borundia
>> Cc: linux-kernel; trivial@kernel.org
>> Subject: [PATCH -next] qlcnic: fix compiler warning
>> 
>> Add an explicit cast to fix the following warning (seen on Debian Wheezy, gcc
>> 4.7.2)
>> 
>> CC [M]  drivers/net/wireless/rtlwifi/rtl8192ce/trx.o
>>     drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c: In function
>> ¡qlcnic_send_filter¢:
>>     drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c:349:3: warning:
>>     passing argument 2 of ¡ether_addr_equal¢ from incompatible pointer type
>> [enabled by default]
>>     In file included from include/linux/if_vlan.h:16:0,
>>     from drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c:9:
>>     include/linux/etherdevice.h:244:20: note: expected ¡const u8 *¢ but
>> argument is of type ¡u64 *¢
>>
> 
> If I am not wrong, this patch should go to David's net-next tree.
>  
>> Signed-off-by: Martin Kaiser <martin@kaiser.cx>
> 
> Acked-by: Shahed Shaikh <shahed.shaikh@qlogic.com>

Please post the original patch to netdev so that it properly gets
queued up in patchwork, thank you very much.
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

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

* Re: [PATCH -next] qlcnic: fix compiler warning
  2014-01-14 15:21 Martin Kaiser
@ 2014-01-15  2:06 ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2014-01-15  2:06 UTC (permalink / raw)
  To: martin; +Cc: netdev, shahed.shaikh, linux-kernel, trivial

From: Martin Kaiser <martin@kaiser.cx>
Date: Tue, 14 Jan 2014 16:21:28 +0100

> re-sent as requested by David M.

Sorry, dianthong sent his version of the fix meanwhile and I applied
his copy.

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

* Re: [PATCH -next] qlcnic: fix compiler warning
@ 2014-01-14 15:21 Martin Kaiser
  2014-01-15  2:06 ` David Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Kaiser @ 2014-01-14 15:21 UTC (permalink / raw)
  To: netdev; +Cc: David Miller, shahed.shaikh, linux-kernel, trivial

re-sent as requested by David M.
(I understand the concerns about portability that were raised. At the moment, I don't have a possiblity to do
further rework and testing)

Add an explicit cast to fix the following warning
(seen on Debian Wheezy, gcc 4.7.2)

CC [M]  drivers/net/wireless/rtlwifi/rtl8192ce/trx.o
    drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c: In function ‘qlcnic_send_filter’:
    drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c:349:3: warning:                   
    passing argument 2 of ‘ether_addr_equal’ from incompatible pointer type [enabled by default]
    In file included from include/linux/if_vlan.h:16:0,                                         
    from drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c:9:
    include/linux/etherdevice.h:244:20: note: expected ‘const u8 *’ but argument is of type ‘u64 *’

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Acked-by: Shahed Shaikh <shahed.shaikh@qlogic.com>
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
index 6373f60..3557154 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
@@ -346,7 +346,7 @@ static void qlcnic_send_filter(struct qlcnic_adapter *adapter,
        head = &(adapter->fhash.fhead[hindex]);

        hlist_for_each_entry_safe(tmp_fil, n, head, fnode) {
-               if (ether_addr_equal(tmp_fil->faddr, &src_addr) &&
+               if (ether_addr_equal(tmp_fil->faddr, (const u8 *)&src_addr) &&
                    tmp_fil->vlan_id == vlan_id) {
                        if (jiffies > (QLCNIC_READD_AGE * HZ + tmp_fil->ftime))
                                qlcnic_change_filter(adapter, &src_addr,


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

end of thread, other threads:[~2014-01-15  2:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-09 15:59 [PATCH -next] qlcnic: fix compiler warning Martin Kaiser
2014-01-10  7:19 ` Shahed Shaikh
2014-01-10 10:15   ` David Laight
2014-01-13 22:46   ` David Miller
2014-01-14 15:21 Martin Kaiser
2014-01-15  2:06 ` David Miller

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

Powered by JetHome