linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bo YU <tsu.yubo@gmail.com>
To: j.vosburgh@gmail.com, vfalico@gmail.com, andy@greyhouse.net,
	davem@davemloft.net
Cc: Bo YU <tsu.yubo@gmail.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	yuzibode@126.com
Subject: [PATCH 1/2] net: bonding: fix restricted __be16 degrades to integer
Date: Fri,  8 Mar 2019 00:33:50 -0500	[thread overview]
Message-ID: <2a069375f8393bf05a44669e00281714063a8530.1552023000.git.tsu.yubo@gmail.com> (raw)
In-Reply-To: <cover.1552023000.git.tsu.yubo@gmail.com>

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@gmail.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


  reply	other threads:[~2019-03-08  5:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-08  5:33 [PATCH 0/2] net: bonding: fix sparse warning Bo YU
2019-03-08  5:33 ` Bo YU [this message]
2019-03-08 20:54   ` [PATCH 1/2] net: bonding: fix restricted __be16 degrades to integer Jay Vosburgh
2019-03-08  5:34 ` [PATCH 2/2] net: bonding: fix incorrect type in assignment Bo YU
2019-03-08  6:51   ` Jay Vosburgh
2019-03-08  8:28     ` Bo YU

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2a069375f8393bf05a44669e00281714063a8530.1552023000.git.tsu.yubo@gmail.com \
    --to=tsu.yubo@gmail.com \
    --cc=andy@greyhouse.net \
    --cc=davem@davemloft.net \
    --cc=j.vosburgh@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=vfalico@gmail.com \
    --cc=yuzibode@126.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).