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-next>] [day] [month] [year] [list]
Date:   Tue, 7 Aug 2018 07:07:20 +0800
From:   kbuild test robot <lkp@...el.com>
To:     Alexander Aring <aring@...atatu.com>
Cc:     kbuild-all@...org, netdev@...r.kernel.org,
        Stefan Schmidt <stefan@...enfreihafen.org>
Subject: [net-next:master 1745/1753]
 drivers/net/ieee802154/mac802154_hwsim.c:39:14: sparse: incorrect type in
 initializer (different address spaces)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git master
head:   de7de576eca204de9a38e2f6dafe6b7c1ddc85c1
commit: f25da51fdc381ca2863248c7060b3662632f0872 [1745/1753] ieee802154: hwsim: add replacement for fakelb
reproduce:
        # apt-get install sparse
        git checkout f25da51fdc381ca2863248c7060b3662632f0872
        make ARCH=x86_64 allmodconfig
        make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

>> drivers/net/ieee802154/mac802154_hwsim.c:39:14: sparse: incorrect type in initializer (different address spaces) @@    expected struct list_head *next @@    got struct list_head struct list_head *next @@
   drivers/net/ieee802154/mac802154_hwsim.c:39:14:    expected struct list_head *next
   drivers/net/ieee802154/mac802154_hwsim.c:39:14:    got struct list_head [noderef] <asn:4>*<noident>
>> drivers/net/ieee802154/mac802154_hwsim.c:39:14: sparse: incorrect type in initializer (different address spaces) @@    expected struct list_head *prev @@    got struct list_head struct list_head *prev @@
   drivers/net/ieee802154/mac802154_hwsim.c:39:14:    expected struct list_head *prev
   drivers/net/ieee802154/mac802154_hwsim.c:39:14:    got struct list_head [noderef] <asn:4>*<noident>
>> drivers/net/ieee802154/mac802154_hwsim.c:799:18: sparse: incorrect type in assignment (different address spaces) @@    expected struct hwsim_pib [noderef] <asn:4>*pib @@    got  hwsim_pib [noderef] <asn:4>*pib @@
   drivers/net/ieee802154/mac802154_hwsim.c:799:18:    expected struct hwsim_pib [noderef] <asn:4>*pib
   drivers/net/ieee802154/mac802154_hwsim.c:799:18:    got struct hwsim_pib *[assigned] pib
>> drivers/net/ieee802154/mac802154_hwsim.c:801:25: sparse: incorrect type in argument 1 (different modifiers) @@    expected struct list_head *list @@    got struct lisstruct list_head *list @@
   drivers/net/ieee802154/mac802154_hwsim.c:801:25:    expected struct list_head *list
   drivers/net/ieee802154/mac802154_hwsim.c:801:25:    got struct list_head [noderef] *<noident>
>> drivers/net/ieee802154/mac802154_hwsim.c:835:9: sparse: incorrect type in argument 1 (different address spaces) @@    expected struct callback_head *head @@    got struct callback_hstruct callback_head *head @@
   drivers/net/ieee802154/mac802154_hwsim.c:835:9:    expected struct callback_head *head
   drivers/net/ieee802154/mac802154_hwsim.c:835:9:    got struct callback_head [noderef] <asn:4>*<noident>
>> drivers/net/ieee802154/mac802154_hwsim.c:113:17: sparse: incorrect type in assignment (different address spaces) @@    expected struct hwsim_pib *pib_old @@    got struct hwsim_pib struct hwsim_pib *pib_old @@
   drivers/net/ieee802154/mac802154_hwsim.c:113:17:    expected struct hwsim_pib *pib_old
   drivers/net/ieee802154/mac802154_hwsim.c:113:17:    got struct hwsim_pib [noderef] <asn:4>*pib
>> drivers/net/ieee802154/mac802154_hwsim.c:130:9: sparse: incompatible types in comparison expression (different modifiers)
>> drivers/net/ieee802154/mac802154_hwsim.c:144:33: sparse: incompatible types in comparison expression (different address spaces)
>> drivers/net/ieee802154/mac802154_hwsim.c:161:40: sparse: incorrect type in argument 2 (different address spaces) @@    expected struct list_head *head @@    got struct list_head struct list_head *head @@
   drivers/net/ieee802154/mac802154_hwsim.c:161:40:    expected struct list_head *head
   drivers/net/ieee802154/mac802154_hwsim.c:161:40:    got struct list_head [noderef] <asn:4>*<noident>
>> drivers/net/ieee802154/mac802154_hwsim.c:232:25: sparse: incorrect type in argument 1 (different modifiers) @@    expected struct list_head const *head @@    got strustruct list_head const *head @@
   drivers/net/ieee802154/mac802154_hwsim.c:232:25:    expected struct list_head const *head
   drivers/net/ieee802154/mac802154_hwsim.c:232:25:    got struct list_head [noderef] *<noident>
   drivers/net/ieee802154/mac802154_hwsim.c:243:9: sparse: incompatible types in comparison expression (different modifiers)
   drivers/net/ieee802154/mac802154_hwsim.c:260:25: sparse: incompatible types in comparison expression (different address spaces)
   drivers/net/ieee802154/mac802154_hwsim.c:460:9: sparse: incompatible types in comparison expression (different modifiers)
   drivers/net/ieee802154/mac802154_hwsim.c:515:9: sparse: incompatible types in comparison expression (different modifiers)
   drivers/net/ieee802154/mac802154_hwsim.c:573:9: sparse: incompatible types in comparison expression (different modifiers)
   drivers/net/ieee802154/mac802154_hwsim.c:695:17: sparse: incompatible types in comparison expression (different modifiers)
>> drivers/net/ieee802154/mac802154_hwsim.c:717:41: sparse: incorrect type in argument 2 (different modifiers) @@    expected struct list_head *head @@    got struct lisstruct list_head *head @@
   drivers/net/ieee802154/mac802154_hwsim.c:717:41:    expected struct list_head *head
   drivers/net/ieee802154/mac802154_hwsim.c:717:41:    got struct list_head [noderef] *<noident>
   drivers/net/ieee802154/mac802154_hwsim.c:725:41: sparse: incorrect type in argument 2 (different modifiers) @@    expected struct list_head *head @@    got struct lisstruct list_head *head @@
   drivers/net/ieee802154/mac802154_hwsim.c:725:41:    expected struct list_head *head
   drivers/net/ieee802154/mac802154_hwsim.c:725:41:    got struct list_head [noderef] *<noident>

vim +39 drivers/net/ieee802154/mac802154_hwsim.c

    38	
  > 39	static __rcu LIST_HEAD(hwsim_ifup_phys);
    40	
    41	static struct platform_device *mac802154hwsim_dev;
    42	
    43	/* MAC802154_HWSIM netlink family */
    44	static struct genl_family hwsim_genl_family;
    45	
    46	static int hwsim_radio_idx;
    47	
    48	enum hwsim_multicast_groups {
    49		HWSIM_MCGRP_CONFIG,
    50	};
    51	
    52	static const struct genl_multicast_group hwsim_mcgrps[] = {
    53		[HWSIM_MCGRP_CONFIG] = { .name = "config", },
    54	};
    55	
    56	struct hwsim_pib {
    57		u8 page;
    58		u8 channel;
    59	
    60		struct rcu_head rcu;
    61	};
    62	
    63	struct hwsim_edge_info {
    64		u8 lqi;
    65	
    66		struct rcu_head rcu;
    67	};
    68	
    69	struct hwsim_edge {
    70		struct hwsim_phy *endpoint;
    71		struct hwsim_edge_info *info;
    72	
    73		struct list_head list;
    74		struct rcu_head rcu;
    75	};
    76	
    77	struct hwsim_phy {
    78		struct ieee802154_hw *hw;
    79		u32 idx;
    80	
    81		struct hwsim_pib __rcu *pib;
    82	
    83		bool suspended;
    84		struct list_head __rcu edges;
    85	
    86		struct list_head list;
    87		struct list_head list_ifup;
    88	};
    89	
    90	static int hwsim_add_one(struct genl_info *info, struct device *dev,
    91				 bool init);
    92	static void hwsim_del(struct hwsim_phy *phy);
    93	
    94	static int hwsim_hw_ed(struct ieee802154_hw *hw, u8 *level)
    95	{
    96		*level = 0xbe;
    97	
    98		return 0;
    99	}
   100	
   101	static int hwsim_hw_channel(struct ieee802154_hw *hw, u8 page, u8 channel)
   102	{
   103		struct hwsim_phy *phy = hw->priv;
   104		struct hwsim_pib *pib, *pib_old;
   105	
   106		pib = kzalloc(sizeof(*pib), GFP_KERNEL);
   107		if (!pib)
   108			return -ENOMEM;
   109	
   110		pib->page = page;
   111		pib->channel = channel;
   112	
 > 113		pib_old = phy->pib;
   114		rcu_assign_pointer(phy->pib, pib);
   115		kfree_rcu(pib_old, rcu);
   116		return 0;
   117	}
   118	
   119	static int hwsim_hw_xmit(struct ieee802154_hw *hw, struct sk_buff *skb)
   120	{
   121		struct hwsim_phy *current_phy = hw->priv;
   122		struct hwsim_pib *current_pib, *endpoint_pib;
   123		struct hwsim_edge_info *einfo;
   124		struct hwsim_edge *e;
   125	
   126		WARN_ON(current_phy->suspended);
   127	
   128		rcu_read_lock();
   129		current_pib = rcu_dereference(current_phy->pib);
 > 130		list_for_each_entry_rcu(e, &current_phy->edges, list) {
   131			/* Can be changed later in rx_irqsafe, but this is only a
   132			 * performance tweak. Received radio should drop the frame
   133			 * in mac802154 stack anyway... so we don't need to be
   134			 * 100% of locking here to check on suspended
   135			 */
   136			if (e->endpoint->suspended)
   137				continue;
   138	
   139			endpoint_pib = rcu_dereference(e->endpoint->pib);
   140			if (current_pib->page == endpoint_pib->page &&
   141			    current_pib->channel == endpoint_pib->channel) {
   142				struct sk_buff *newskb = pskb_copy(skb, GFP_ATOMIC);
   143	
 > 144				einfo = rcu_dereference(e->info);
   145				if (newskb)
   146					ieee802154_rx_irqsafe(e->endpoint->hw, newskb,
   147							      einfo->lqi);
   148			}
   149		}
   150		rcu_read_unlock();
   151	
   152		ieee802154_xmit_complete(hw, skb, false);
   153		return 0;
   154	}
   155	
   156	static int hwsim_hw_start(struct ieee802154_hw *hw)
   157	{
   158		struct hwsim_phy *phy = hw->priv;
   159	
   160		phy->suspended = false;
 > 161		list_add_rcu(&phy->list_ifup, &hwsim_ifup_phys);
   162		synchronize_rcu();
   163	
   164		return 0;
   165	}
   166	
   167	static void hwsim_hw_stop(struct ieee802154_hw *hw)
   168	{
   169		struct hwsim_phy *phy = hw->priv;
   170	
   171		phy->suspended = true;
   172		list_del_rcu(&phy->list_ifup);
   173		synchronize_rcu();
   174	}
   175	
   176	static int
   177	hwsim_set_promiscuous_mode(struct ieee802154_hw *hw, const bool on)
   178	{
   179		return 0;
   180	}
   181	
   182	static const struct ieee802154_ops hwsim_ops = {
   183		.owner = THIS_MODULE,
   184		.xmit_async = hwsim_hw_xmit,
   185		.ed = hwsim_hw_ed,
   186		.set_channel = hwsim_hw_channel,
   187		.start = hwsim_hw_start,
   188		.stop = hwsim_hw_stop,
   189		.set_promiscuous_mode = hwsim_set_promiscuous_mode,
   190	};
   191	
   192	static int hwsim_new_radio_nl(struct sk_buff *msg, struct genl_info *info)
   193	{
   194		return hwsim_add_one(info, &mac802154hwsim_dev->dev, false);
   195	}
   196	
   197	static int hwsim_del_radio_nl(struct sk_buff *msg, struct genl_info *info)
   198	{
   199		struct hwsim_phy *phy, *tmp;
   200		s64 idx = -1;
   201	
   202		if (!info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID])
   203			return -EINVAL;
   204	
   205		idx = nla_get_u32(info->attrs[MAC802154_HWSIM_ATTR_RADIO_ID]);
   206	
   207		mutex_lock(&hwsim_phys_lock);
   208		list_for_each_entry_safe(phy, tmp, &hwsim_phys, list) {
   209			if (idx == phy->idx) {
   210				hwsim_del(phy);
   211				mutex_unlock(&hwsim_phys_lock);
   212				return 0;
   213			}
   214		}
   215		mutex_unlock(&hwsim_phys_lock);
   216	
   217		return -ENODEV;
   218	}
   219	
   220	static int append_radio_msg(struct sk_buff *skb, struct hwsim_phy *phy)
   221	{
   222		struct nlattr *nl_edges, *nl_edge;
   223		struct hwsim_edge_info *einfo;
   224		struct hwsim_edge *e;
   225		int ret;
   226	
   227		ret = nla_put_u32(skb, MAC802154_HWSIM_ATTR_RADIO_ID, phy->idx);
   228		if (ret < 0)
   229			return ret;
   230	
   231		rcu_read_lock();
 > 232		if (list_empty(&phy->edges)) {
   233			rcu_read_unlock();
   234			return 0;
   235		}
   236	
   237		nl_edges = nla_nest_start(skb, MAC802154_HWSIM_ATTR_RADIO_EDGES);
   238		if (!nl_edges) {
   239			rcu_read_unlock();
   240			return -ENOBUFS;
   241		}
   242	
   243		list_for_each_entry_rcu(e, &phy->edges, list) {
   244			nl_edge = nla_nest_start(skb, MAC802154_HWSIM_ATTR_RADIO_EDGE);
   245			if (!nl_edge) {
   246				rcu_read_unlock();
   247				nla_nest_cancel(skb, nl_edges);
   248				return -ENOBUFS;
   249			}
   250	
   251			ret = nla_put_u32(skb, MAC802154_HWSIM_EDGE_ATTR_ENDPOINT_ID,
   252					  e->endpoint->idx);
   253			if (ret < 0) {
   254				rcu_read_unlock();
   255				nla_nest_cancel(skb, nl_edge);
   256				nla_nest_cancel(skb, nl_edges);
   257				return ret;
   258			}
   259	
   260			einfo = rcu_dereference(e->info);
   261			ret = nla_put_u8(skb, MAC802154_HWSIM_EDGE_ATTR_LQI,
   262					 einfo->lqi);
   263			if (ret < 0) {
   264				rcu_read_unlock();
   265				nla_nest_cancel(skb, nl_edge);
   266				nla_nest_cancel(skb, nl_edges);
   267				return ret;
   268			}
   269	
   270			nla_nest_end(skb, nl_edge);
   271		}
   272		rcu_read_unlock();
   273	
   274		nla_nest_end(skb, nl_edges);
   275	
   276		return 0;
   277	}
   278	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ