Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp5668277imb; Thu, 7 Mar 2019 22:51:53 -0800 (PST) X-Google-Smtp-Source: APXvYqx0jeI01b/nVDp6PT5Kx54h5qMlncGsQwCe9zKcGXSBbio/3jPI+VWk0+b7oPJA9NJBO39R X-Received: by 2002:a62:3890:: with SMTP id f138mr17291865pfa.148.1552027913485; Thu, 07 Mar 2019 22:51:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552027913; cv=none; d=google.com; s=arc-20160816; b=kTVcT+/cvyDu44u2hkkTmkL3j22QXYjPFA1JOvgKCdaSikw4fomdgJTWYJu39OvmvM oLmgusI17XytbWG7WVPYBRBNX6R79cA3Jsj+ZYkMPIWGgLeX3fJO1zve+3OrRKz3TtR5 YLkbHiVR9utwc/I0Vp3mBCVb4VU9/M6uQGU++g/6XqxAmHOonj9YNJQNZu7xf3v11USF 0ufG40WXHySE0JwYxc7luLiuykRYR8uaR3kxg2WZYmPDFDA5RPKwUV9E6ZqZ68Ob/0a5 JK5EYxwqHXLCsJ41/1s9RsjDVaab7bmxIV349fWLIAIkWIq9FjDgLrXnQXGvYarfvx4Y QxfA== 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=velyza6n5qhC41ob87AZKacnIHjdE8fmjIhrOUXGYyw=; b=Hu7h70dXqndcGLmnyG845DC7c43PhM0LG40ES925QiN3miQm56VaTTH83jDtfSjCkG OzWoXhATChUOVtx52qvnj4hspT/rL/DLTeY09Yv2Zl6cJnew7uVp2DNLkvAV+ynJgVMY 8UFwig2KAIWqlUJVQcrhFHvYlrcxsEjVAuILtU1rruows8X+8EuEUP2j5CPCHEQnRMrL fDh66IkJYGiyijYE/p7h5/9vpFN88NSe/DCouZCbxVDfa5YGTaEVAvJ6Q5tm/G4zR4MX bD7iAvIHlOSQ2LlzRZhU9V4KneYoLsty0xy/KxhHoRwstsliQ+o2oPKhbXtaUPs/2kN1 17Gw== 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 t17si5840276pgg.452.2019.03.07.22.51.37; Thu, 07 Mar 2019 22:51:53 -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 S1726427AbfCHGvP convert rfc822-to-8bit (ORCPT + 99 others); Fri, 8 Mar 2019 01:51:15 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:36732 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725766AbfCHGvP (ORCPT ); Fri, 8 Mar 2019 01:51:15 -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 1h29LY-0008I7-Pr; Fri, 08 Mar 2019 06:51:09 +0000 Received: by famine.localdomain (Postfix, from userid 1000) id C231760868; Thu, 7 Mar 2019 22:51:06 -0800 (PST) Received: from famine (localhost [127.0.0.1]) by famine.localdomain (Postfix) with ESMTP id BA7AF9F839; Thu, 7 Mar 2019 22:51:06 -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 2/2] net: bonding: fix incorrect type in assignment In-reply-to: <2fefb2a6962f668f76db79d2f9a2b866b077e42f.1552023000.git.tsu.yubo@gmail.com> References: <2fefb2a6962f668f76db79d2f9a2b866b077e42f.1552023000.git.tsu.yubo@gmail.com> Comments: In-reply-to Bo YU message dated "Fri, 08 Mar 2019 00:34:05 -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: <6017.1552027866.1@famine> Content-Transfer-Encoding: 8BIT Date: Thu, 07 Mar 2019 22:51:06 -0800 Message-ID: <6018.1552027866@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:2438:40: warning: incorrect type in assignment (different base types) >drivers/net/bonding/bond_main.c:2438:40: expected restricted __be16 [usertype] vlan_proto >drivers/net/bonding/bond_main.c:2438:40: >... >rivers/net/bonding/bond_options.c:1089:24: warning: incorrect type in assignment (different base types) >drivers/net/bonding/bond_options.c:1089:24: expected restricted __be32 [addressable] [usertype] target >drivers/net/bonding/bond_options.c:1089:24: got unsigned long long const [usertype] value > >So fix it > >Signed-off-by: Bo YU >--- > drivers/net/bonding/bond_main.c | 2 +- > drivers/net/bonding/bond_options.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > >diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c >index 135fec28daa9..07e52d863e91 100644 >--- a/drivers/net/bonding/bond_main.c >+++ b/drivers/net/bonding/bond_main.c >@@ -2435,7 +2435,7 @@ struct bond_vlan_tag *bond_verify_device_path(struct net_device *start_dev, > tags = kcalloc(level + 1, sizeof(*tags), GFP_ATOMIC); > if (!tags) > return ERR_PTR(-ENOMEM); >- tags[level].vlan_proto = VLAN_N_VID; >+ tags[level].vlan_proto = cpu_to_be16(VLAN_N_VID); > return tags; > } > >diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c >index da1fc17295d9..3a196999bd1b 100644 >--- a/drivers/net/bonding/bond_options.c >+++ b/drivers/net/bonding/bond_options.c >@@ -1086,7 +1086,7 @@ static int bond_option_arp_ip_targets_set(struct bonding *bond, > else > netdev_err(bond->dev, "no command found in arp_ip_targets file - use + or -\n"); > } else { >- target = newval->value; >+ target = cpu_to_be32(newval->value); > ret = bond_option_arp_ip_target_add(bond, target); I'm not sure this is correct; if I'm reading the call path correctly, bond_changelink will if (data[IFLA_BOND_ARP_IP_TARGET]) { [...] __be32 target; [...] target = nla_get_be32(attr); bond_opt_initval(&newval, (__force u64)target); err = __bond_opt_set(bond, BOND_OPT_ARP_TARGETS, &newval); thus, newval.value is initially be32, but stored in a u64. __bond_opt_set will call bond_opt_parse, which in turn will call bond_option_arp_ip_targets_set (via .set), and the change above would swap the newval.value back to host order (on little endian architectures for which cpu_to_be32 is not a no-op). Am I misunderstanding? Did you test this change on an x86 or other little endian system? -J --- -Jay Vosburgh, jay.vosburgh@canonical.com