netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next:master 14/17] net/bridge/br_mdb.c:330 br_mdb_add_group() error: potential null dereference 'mp'. (br_multicast_new_group returns null)
@ 2012-12-12 19:21 kbuild test robot
  2012-12-13  7:15 ` Cong Wang
  0 siblings, 1 reply; 2+ messages in thread
From: kbuild test robot @ 2012-12-12 19:21 UTC (permalink / raw)
  To: Cong Wang; +Cc: netdev

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git master
head:   520dfe3a3645257bf83660f672c47f8558f3d4c4
commit: cfd567543590f71ca0af397437e2554f9756d750 [14/17] bridge: add support of adding and deleting mdb entries


smatch warnings:

+ net/bridge/br_mdb.c:330 br_mdb_add_group() error: potential null dereference 'mp'.  (br_multicast_new_group returns null)

vim +330 +/mp net/bridge/br_mdb.c

cfd56754 Cong Wang 2012-12-11  314  {
cfd56754 Cong Wang 2012-12-11  315  	struct net_bridge_mdb_entry *mp;
cfd56754 Cong Wang 2012-12-11  316  	struct net_bridge_port_group *p;
cfd56754 Cong Wang 2012-12-11  317  	struct net_bridge_port_group __rcu **pp;
cfd56754 Cong Wang 2012-12-11  318  	struct net_bridge_mdb_htable *mdb;
cfd56754 Cong Wang 2012-12-11  319  	int err;
cfd56754 Cong Wang 2012-12-11  320  
cfd56754 Cong Wang 2012-12-11  321  	mdb = mlock_dereference(br->mdb, br);
cfd56754 Cong Wang 2012-12-11  322  	mp = br_mdb_ip_get(mdb, group);
cfd56754 Cong Wang 2012-12-11  323  	if (!mp) {
cfd56754 Cong Wang 2012-12-11  324  		mp = br_multicast_new_group(br, port, group);
cfd56754 Cong Wang 2012-12-11  325  		err = PTR_ERR(mp);
cfd56754 Cong Wang 2012-12-11  326  		if (IS_ERR(mp))
cfd56754 Cong Wang 2012-12-11  327  			return err;
cfd56754 Cong Wang 2012-12-11  328  	}
cfd56754 Cong Wang 2012-12-11  329  
cfd56754 Cong Wang 2012-12-11 @330  	for (pp = &mp->ports;
cfd56754 Cong Wang 2012-12-11  331  	     (p = mlock_dereference(*pp, br)) != NULL;
cfd56754 Cong Wang 2012-12-11  332  	     pp = &p->next) {
cfd56754 Cong Wang 2012-12-11  333  		if (p->port == port)
cfd56754 Cong Wang 2012-12-11  334  			return -EEXIST;
cfd56754 Cong Wang 2012-12-11  335  		if ((unsigned long)p->port < (unsigned long)port)
cfd56754 Cong Wang 2012-12-11  336  			break;
cfd56754 Cong Wang 2012-12-11  337  	}
cfd56754 Cong Wang 2012-12-11  338  

---
0-DAY kernel build testing backend         Open Source Technology Center
Fengguang Wu, Yuanhan Liu                              Intel Corporation

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [net-next:master 14/17] net/bridge/br_mdb.c:330 br_mdb_add_group() error: potential null dereference 'mp'. (br_multicast_new_group returns null)
  2012-12-12 19:21 [net-next:master 14/17] net/bridge/br_mdb.c:330 br_mdb_add_group() error: potential null dereference 'mp'. (br_multicast_new_group returns null) kbuild test robot
@ 2012-12-13  7:15 ` Cong Wang
  0 siblings, 0 replies; 2+ messages in thread
From: Cong Wang @ 2012-12-13  7:15 UTC (permalink / raw)
  To: kbuild test robot; +Cc: netdev

On Thu, 2012-12-13 at 03:21 +0800, kbuild test robot wrote:
> tree:   git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git master
> head:   520dfe3a3645257bf83660f672c47f8558f3d4c4
> commit: cfd567543590f71ca0af397437e2554f9756d750 [14/17] bridge: add support of adding and deleting mdb entries
> 
> 
> smatch warnings:
> 
> + net/bridge/br_mdb.c:330 br_mdb_add_group() error: potential null dereference 'mp'.  (br_multicast_new_group returns null)

br_multicast_new_group() seems impossible to return NULL, it either
returns a valid pointer (non-NULL) or some errno pointer.

OTOH, br_multicast_add_group() doesn't check for NULL either.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-12-13  7:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-12 19:21 [net-next:master 14/17] net/bridge/br_mdb.c:330 br_mdb_add_group() error: potential null dereference 'mp'. (br_multicast_new_group returns null) kbuild test robot
2012-12-13  7:15 ` Cong Wang

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).