netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: matti.vaittinen@nsn.com
Cc: netdev@vger.kernel.org
Subject: re: IPv6 routing, NLM_F_* flag support: REPLACE and EXCL
Date: Tue, 15 Nov 2011 12:01:07 +0300	[thread overview]
Message-ID: <20111115090107.GA18307@elgon.mountain> (raw)

flags support, warn about missing CREATE flag

Hello Matti Vaittinen,

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

The patch 4a287eba2de3: "IPv6 routing, NLM_F_* flag support: REPLACE 
and EXCL flags support, warn about missing CREATE flag" from Nov 14, 
2011, leads to the following Smatch complaint:

net/ipv6/ip6_fib.c +656 fib6_add_rt2node()
	 error: we previously assumed 'info' could be null (see line 641)

net/ipv6/ip6_fib.c
   640		    (info->nlh->nlmsg_flags&NLM_F_REPLACE));
   641		int add = ((NULL == info || NULL == info->nlh) ||
                            ^^^^^^^^^^^^
Checked here.

   642		    (info->nlh->nlmsg_flags&NLM_F_CREATE));
   643		int found = 0;
   644	
   645		ins = &fn->leaf;
   646	
   647		for (iter = fn->leaf; iter; iter=iter->dst.rt6_next) {
   648			/*
   649			 *	Search for duplicates
   650			 */
   651	
   652			if (iter->rt6i_metric == rt->rt6i_metric) {
   653				/*
   654				 *	Same priority level
   655				 */
   656				if (NULL != info->nlh &&
                                            ^^^^^^^^^
Not checked here.  Btw, I looked at the callers and info is always
a valid pointer.

   657				    (info->nlh->nlmsg_flags&NLM_F_EXCL))
   658					return -EEXIST;

regards,
dan carpenter

             reply	other threads:[~2011-11-15  9:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-15  9:01 Dan Carpenter [this message]
2011-11-15 10:26 ` IPv6 routing, NLM_F_* flag support: REPLACE and EXCL Matti Vaittinen

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=20111115090107.GA18307@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=matti.vaittinen@nsn.com \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).