Ethernet Bridge development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: roopa@cumulusnetworks.com
Cc: bridge@lists.linux-foundation.org
Subject: Re: [Bridge] bridge: offload bridge port attributes to switch asic if feature flag set
Date: Thu, 5 Feb 2015 15:34:15 +0300	[thread overview]
Message-ID: <20150205123415.GA12005@mwanda> (raw)

Hello Roopa Prabhu,

This is a semi-automatic email about new static checker warnings.

The patch 68e331c785b8: "bridge: offload bridge port attributes to
switch asic if feature flag set" from Jan 29, 2015, leads to the
following Smatch complaint:

net/bridge/br_netlink.c:552 br_setlink()
	 error: we previously assumed 'p' could be null (see line 518)

net/bridge/br_netlink.c
   517	
   518		if (p && protinfo) {
                    ^
Check for NULL.

   519			if (protinfo->nla_type & NLA_F_NESTED) {
   520				err = nla_parse_nested(tb, IFLA_BRPORT_MAX,
   521						       protinfo, br_port_policy);
   522				if (err)
   523					return err;
   524	
   525				spin_lock_bh(&p->br->lock);
   526				err = br_setport(p, tb);
   527				spin_unlock_bh(&p->br->lock);
   528			} else {
   529				/* Binary compatibility with old RSTP */
   530				if (nla_len(protinfo) < sizeof(u8))
   531					return -EINVAL;
   532	
   533				spin_lock_bh(&p->br->lock);
   534				err = br_set_port_state(p, nla_get_u8(protinfo));
   535				spin_unlock_bh(&p->br->lock);
   536			}
   537			if (err)
   538				goto out;
   539		}
   540	
   541		if (afspec) {
   542			err = br_afspec((struct net_bridge *)netdev_priv(dev), p,
   543					afspec, RTM_SETLINK);
   544		}
   545	
   546		if (!(flags & BRIDGE_FLAGS_SELF)) {
   547			/* set bridge attributes in hardware if supported
   548			 */
   549			ret_offload = netdev_switch_port_bridge_setlink(dev, nlh,
   550									flags);
   551			if (ret_offload && ret_offload != -EOPNOTSUPP)
   552				br_warn(p->br, "error setting attrs on port %u(%s)\n",
                                        ^^^^^
New dererference.

   553					(unsigned int)p->port_no, p->dev->name);
   554		}


Also:
	net/bridge/br_netlink.c:592 br_dellink()
	error: we previously assumed 'p' could be null (see line 575)

regards,
dan carpenter

             reply	other threads:[~2015-02-05 12:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-05 12:34 Dan Carpenter [this message]
2015-02-05 14:37 ` [Bridge] bridge: offload bridge port attributes to switch asic if feature flag set roopa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150205123415.GA12005@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=bridge@lists.linux-foundation.org \
    --cc=roopa@cumulusnetworks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox