Skip to contentSkip to conversation

qlcnic: fix compiler warning

PATCH In review Martin Kaiser 4 participants 4 messages Jan 9, 2014 – Jan 13, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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 *’

---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c +1 -1
index 6373f60..3557154 100644
@@ -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,
Signature · 1 line
1.7.10.4
Acked-by on v1 1/1
#1 lore raw

Adding netdev.

Quoted 11 lines

-----Original Message-----
From: Martin Kaiser,,, [mailto:[email protected]] On Behalf Of Martin Kaiser
Sent: Thursday, January 09, 2014 9:29 PM
To: Himanshu Madhani; Rajesh Borundia
Cc: linux-kernel; [email protected]
Subject: [PATCH -next] qlcnic: fix compiler warning

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

Quoted 11 lines

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.

Quoted 1 line

Thanks,
Shahed

Quoted 23 lines
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c +1 -1
index 6373f60..3557154 100644
@@ -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)

&&

drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c +0 -0
 		    tmp_fil->vlan_id == vlan_id) {
 			if (jiffies > (QLCNIC_READD_AGE * HZ + tmp_fil-
Quoted 1 line

ftime))

qlcnic_change_filter(adapter, &src_addr,
--
1.7.10.4

#2 lore raw

From: Shahed Shaikh

Quoted 25 lines

Adding netdev.

Quoted 11 lines

-----Original Message-----
From: Martin Kaiser,,, [mailto:[email protected]] On Behalf Of Martin Kaiser
Sent: Thursday, January 09, 2014 9:29 PM
To: Himanshu Madhani; Rajesh Borundia
Cc: linux-kernel; [email protected]
Subject: [PATCH -next] qlcnic: fix compiler warning

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

Quoted 11 lines

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 *

Quoted 31 lines

If I am not wrong, this patch should go to David's net-next tree.

Quoted 1 line

Thanks,
Shahed

Quoted 23 lines
---
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c +1 -1
index 6373f60..3557154 100644
@@ -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)

&&

drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c +0 -0
 		    tmp_fil->vlan_id == vlan_id) {
 			if (jiffies > (QLCNIC_READD_AGE * HZ + tmp_fil-
Quoted 1 line

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

maintainer
#3 lore raw
In reply to Shahed Shaikh

From: Shahed Shaikh <[email protected]>
Date: Fri, 10 Jan 2014 07:19:19 +0000

Quoted 26 lines

Adding netdev.

Quoted 11 lines

-----Original Message-----
From: Martin Kaiser,,, [mailto:[email protected]] On Behalf Of Martin Kaiser
Sent: Thursday, January 09, 2014 9:29 PM
To: Himanshu Madhani; Rajesh Borundia
Cc: linux-kernel; [email protected]
Subject: [PATCH -next] qlcnic: fix compiler warning

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

Quoted 11 lines

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 *’

Quoted 5 lines

If I am not wrong, this patch should go to David's net-next tree.

Quoted 1 line

Please post the original patch to netdev so that it properly gets queued up in patchwork, thank you very much.