lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri,  8 Mar 2019 00:33:50 -0500
From:   Bo YU <tsu.yubo@...il.com>
To:     j.vosburgh@...il.com, vfalico@...il.com, andy@...yhouse.net,
        davem@...emloft.net
Cc:     Bo YU <tsu.yubo@...il.com>, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, yuzibode@....com
Subject: [PATCH 1/2] net: bonding: fix restricted __be16 degrades to integer

There are some warning when:

sudo make C=1 CF=-D__CHECK_ENDIAN__ drivers/net/bonding/

drivers/net/bonding/bond_main.c:2385:26: warning: restricted __be16 degrades to integer
drivers/net/bonding/bond_main.c:2391:20: warning: restricted __be16 degrades to integer
...
drivers/net/bonding/bond_main.c:3241:60: warning: restricted __be16 degrades to integer
drivers/net/bonding/bond_main.c:3241:60: warning: restricted __be16 degrades to integer

So fix it.

Signed-off-by: Bo YU <tsu.yubo@...il.com>
---
 drivers/net/bonding/bond_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index b59708c35faf..135fec28daa9 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2382,13 +2382,13 @@ static void bond_arp_send(struct net_device *slave_dev, int arp_op,
 		return;
 	}
 
-	if (!tags || tags->vlan_proto == VLAN_N_VID)
+	if (!tags || be16_to_cpu(tags->vlan_proto) == VLAN_N_VID)
 		goto xmit;
 
 	tags++;
 
 	/* Go through all the tags backwards and add them to the packet */
-	while (tags->vlan_proto != VLAN_N_VID) {
+	while (be16_to_cpu(tags->vlan_proto) != VLAN_N_VID) {
 		if (!tags->vlan_id) {
 			tags++;
 			continue;
@@ -3238,7 +3238,7 @@ static inline u32 bond_eth_hash(struct sk_buff *skb)
 
 	ep = skb_header_pointer(skb, 0, sizeof(hdr_tmp), &hdr_tmp);
 	if (ep)
-		return ep->h_dest[5] ^ ep->h_source[5] ^ ep->h_proto;
+		return ep->h_dest[5] ^ ep->h_source[5] ^ be16_to_cpu(ep->h_proto);
 	return 0;
 }
 
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ