Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp5724247imb; Fri, 8 Mar 2019 00:29:54 -0800 (PST) X-Google-Smtp-Source: APXvYqzPUkD6qwtMNVWLL8ixU8z0Ik0bTKvxctavCOL41RJi0IEWaUyrkNrx8qwbUaopNkwaDgWV X-Received: by 2002:a62:6046:: with SMTP id u67mr17348143pfb.46.1552033794475; Fri, 08 Mar 2019 00:29:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552033794; cv=none; d=google.com; s=arc-20160816; b=vXwcvnQoZI/Z5eiXkjQZ5WKjtZetWyJO2DU+Salxf8iMi0GNEJK9qfQYGVbONiVaKM uAHAhH531Av5KF6nrOrt+pEBY6woU5Wc0PNDkeWOTvuvpWg0b7J4GCJ0d3hhxNIXV+kA vxfwhhdVWyywf6epPbr1pNf7LQIVdYucmHWvuEG0uzsDRA+fFFKK721gGjMcLHiFZ/+A 967Peh6y/AKPLZHjZAJhg2Rvju33yz1pNnzLA01NlYzdaJsnA2qWN0bqGNCaQwLnuRHC DoC9MrPqzufDUnQYqXevxwMfpmF8+y6hktnYTaTRXu8cJ3Q45UeEXOJ2aGGELlzuh7oI IjYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=jnLYg8s3LQu+SnOMdDKuSXoNPc9Vxko7mN/lAmi1F/Q=; b=vkFVj6h1qS38xOqB4AfoFz2UwNc8OLzpzNXWf0L8eGcfxKEAir4fKNaSNm2A5tcFQ2 hzdc3NhhJD0X8b7Tn608tjzveg0Z7si+Xp6qklv9i9L0hdxbCJRWOBpr9QhXnAmaolrs jNPrGeVOG7ekiNa3yImW2VHmA69R3scRFDFq3GmxegQCiaZs2Vm87G1jI3CEttHJHmsr fCc14XwsSGRlmSM5XP+fKTRLxEsvGmThlUfCcg10vJkeiVdN9FDuh5aTngUlmdGhFlxE FEt1WTr+90ZT8ZDQHorU7tl2I+pwWnaJW1C7FmI0V5n3SeaJzx6AOO0a3TLTb4H/Gyiq gHkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RfIcxshQ; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u14si6058334pgh.561.2019.03.08.00.29.39; Fri, 08 Mar 2019 00:29:54 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RfIcxshQ; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726414AbfCHI24 (ORCPT + 99 others); Fri, 8 Mar 2019 03:28:56 -0500 Received: from mail-yw1-f66.google.com ([209.85.161.66]:44470 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725789AbfCHI24 (ORCPT ); Fri, 8 Mar 2019 03:28:56 -0500 Received: by mail-yw1-f66.google.com with SMTP id x21so15655960ywx.11; Fri, 08 Mar 2019 00:28:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jnLYg8s3LQu+SnOMdDKuSXoNPc9Vxko7mN/lAmi1F/Q=; b=RfIcxshQYxhH1O5QLn9KcijMqLDq3O3owYMwfJdzTUlvBHVABt6G4J+tJIe2UzzSFa AeOTF+8fxmahQ6NfPIRfGzythyjPp3d6rVDkBMpG7diNKt+poBUTYR5ivZiigQ25Ci5V +OEe6qqT4LX2vA6o+HG2ao3Bk1459fjUTXIQiBeBvAIYDpk2uOFyrI6HeyKV14uV/JAi q14c9E1gdYcwxyRS3YQewS+xB3yoxtHTj3HJYB2xnJTkyfFECtOj8IpPvTtTmvXhE2lG S9lyGKx1t1loeriZanP3uA5YL5Yw+ejqh6dBNCQzD0uL3uLAswUuU92du4titVsTixEQ nFOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jnLYg8s3LQu+SnOMdDKuSXoNPc9Vxko7mN/lAmi1F/Q=; b=Ta9+/jP91L/w/UJd//hYtRe8jBU90kCLM1hTyGHeDtY9ERPq0ZXLzUK9zWZJFytyRQ y6egRsTqe6WgnkRfkMCYtvaGOnFBmVYge6t+3ogRmaI5G5UHghMiVEcyASZgpIlr9csS 1HP4Wtn7nOFYQQ54y3OEk9UwmMzCr1uMHjXifio6GSMsn9aNOXCQLMOQwzzTxvwb1mM7 tW/jnXwpnjefSMpl8mx8LGGfq9rBcODiIX7Gxgu/BQM4bRXlWng7fFHW5ek6gexkYD3a jSmMLcE02mzrNVcd8OsNvNHUxcQD/wh56vnrWgv4CFysmHPBUYftg5q2+lRxqLWDdXHS 7ZJg== X-Gm-Message-State: APjAAAWxEUijE5V0L2tmuyfIYrJXNmxtHVwp7jXfp3Qp11000rgF96mR ljLS+A9ggfCrp4bT/S6YQte4/O7yk0QcropYpIe+2MyXkkI+bg== X-Received: by 2002:a81:9a8d:: with SMTP id r135mr13283864ywg.188.1552033735424; Fri, 08 Mar 2019 00:28:55 -0800 (PST) MIME-Version: 1.0 References: <2fefb2a6962f668f76db79d2f9a2b866b077e42f.1552023000.git.tsu.yubo@gmail.com> <6018.1552027866@famine> In-Reply-To: <6018.1552027866@famine> From: Bo YU Date: Fri, 8 Mar 2019 16:28:44 +0800 Message-ID: Subject: Re: [PATCH 2/2] net: bonding: fix incorrect type in assignment To: Jay Vosburgh Cc: vfalico@gmail.com, Andy Gospodarek , David Miller , Netdev , open list , =?UTF-8?B?5LqO5rOi?= Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 8, 2019 at 2:51 PM Jay Vosburgh wrote: > > 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? Hi, After above patch: I have enable BONDING config in .config and dmesg: [ 0.247417] Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011) I don't have the HW, so just add printfk in bond_option_arp_ip_targets_set However, i don't get what i want to print. I do the test in qemu-system-x86_64. I do not know how to hit the driver maybe. So, not confirmed :( > > -J > > --- > -Jay Vosburgh, jay.vosburgh@canonical.com