Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp6250776imb; Fri, 8 Mar 2019 12:55:34 -0800 (PST) X-Google-Smtp-Source: APXvYqw/aSga90FC+nwUJyoV2cn+T5IZ7HEYgvGN5/t3YNUvCsvDHHJdtNnJAb1s8jGkpA4O0y2Z X-Received: by 2002:a65:610d:: with SMTP id z13mr4749149pgu.104.1552078534796; Fri, 08 Mar 2019 12:55:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552078534; cv=none; d=google.com; s=arc-20160816; b=WErm2Ms0l+MqnAg11TJSA/RoDMHV2Og+ZjRfy3sjyQCWV7cjtcXVK/vUs1F5Eev6WC 9waPzSMjUvzEgCEVMlLsY9hMM9J2BgPw/XOSlTea4gT3Un+r6iOj1Tq5dgRDKzjzyRLk ogwaqoVn4Tpo4R95vbMHwuqg0qS6scNsFZUvBIT2jpuHL1nGNi4UKJAgr6EZKq3IRhXf A8waexwE8db4Hd80x+n8ShBmAsvr9QNq0lXBxGjvYRmhA1BHOlf1Xzfc6YwG6lTpim5K mMUOjlQHtSSOvWoKlr6RId9vAjdM/OmRGc0qB9O+74xG97yzF9aGmbG9CZK0865AgoW5 8wvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:content-transfer-encoding :content-id:mime-version:comments:references:in-reply-to:subject:cc :to:from; bh=DzBzfGsQWbhKzZNGaoMkT7nj1DgFK0d2oJLRLvzaHq4=; b=uHZg7e/vp7g5tGdSpJNzrE1+xAK1KcKLtl4hvi+KnmJS3moYIJFJ/SCO0J520X+QZe w2ktiuJscGx5ZY0tQ8GUoD4nILFILCmkRKp8Q9uG/x4r34l7aGcG/4SjfNdSheReilm0 na+oaPnkjh6iGJ19eKtS8vjjXba5GmOel6vAYcx3Y4np3mW4809N6pQ2rxwdHr2btfor upOjZK5PcrwuqrRk0Ma8pF8sf3NjDEFExQWPNtVuSB1IF/GGPJUa6Zm/PYh15kdue3rv WEkaXkCmg7dWdHfnCfuSTnvBUn/6NDpFNTn+PEOs7VtzVCI4Zy2AWQrrUXJ/O0Rn3wjc XNeA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h21si7572196pgl.346.2019.03.08.12.55.19; Fri, 08 Mar 2019 12:55:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727102AbfCHUyz convert rfc822-to-8bit (ORCPT + 99 others); Fri, 8 Mar 2019 15:54:55 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:51571 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726551AbfCHUyy (ORCPT ); Fri, 8 Mar 2019 15:54:54 -0500 Received: from c-67-160-6-8.hsd1.wa.comcast.net ([67.160.6.8] helo=famine.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1h2MW0-0007DK-H0; Fri, 08 Mar 2019 20:54:48 +0000 Received: by famine.localdomain (Postfix, from userid 1000) id 7F7AD60868; Fri, 8 Mar 2019 12:54:46 -0800 (PST) Received: from famine (localhost [127.0.0.1]) by famine.localdomain (Postfix) with ESMTP id 7769E9F839; Fri, 8 Mar 2019 12:54:46 -0800 (PST) From: Jay Vosburgh To: Bo YU cc: vfalico@gmail.com, andy@greyhouse.net, davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, yuzibode@126.com Subject: Re: [PATCH 1/2] net: bonding: fix restricted __be16 degrades to integer In-reply-to: <2a069375f8393bf05a44669e00281714063a8530.1552023000.git.tsu.yubo@gmail.com> References: <2a069375f8393bf05a44669e00281714063a8530.1552023000.git.tsu.yubo@gmail.com> Comments: In-reply-to Bo YU message dated "Fri, 08 Mar 2019 00:33:50 -0500." X-Mailer: MH-E 8.6+git; nmh 1.6; GNU Emacs 27.0.50 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <24215.1552078486.1@famine> Content-Transfer-Encoding: 8BIT Date: Fri, 08 Mar 2019 12:54:46 -0800 Message-ID: <24216.1552078486@famine> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Bo YU wrote: >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 >--- > 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) { I believe both of the above are incorrect, as vlan_proto is set explicitly to VLAN_N_VID (in host byte order) by bond_verify_device_path as a sentinel value. Byte swapping the tags->vlan_proto value would cause the test or loop to miss the sentinel. > 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); This is probably harmless, other than adding work to the transmit path. -J --- -Jay Vosburgh, jay.vosburgh@canonical.com