All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: [bug report] xfrm: add and use xfrm_state_afinfo_get_rcu
Date: Fri, 13 Jan 2017 13:11:15 +0000	[thread overview]
Message-ID: <20170113131115.GA12283@mwanda> (raw)

Hello Florian Westphal,

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

The patch 711059b9752a: "xfrm: add and use xfrm_state_afinfo_get_rcu" 
from Jan 9, 2017, leads to the following Smatch complaint:

net/xfrm/xfrm_state.c:659 xfrm_init_tempstate()
	 error: we previously assumed 'afinfo' could be null (see line 651)

net/xfrm/xfrm_state.c
   643  static void
   644  xfrm_init_tempstate(struct xfrm_state *x, const struct flowi *fl,
   645                      const struct xfrm_tmpl *tmpl,
   646                      const xfrm_address_t *daddr, const xfrm_address_t *saddr,
   647                      unsigned short family)
   648  {
   649          struct xfrm_state_afinfo *afinfo = xfrm_state_afinfo_get_rcu(family);
   650	
   651		if (afinfo)
                    ^^^^^^
Checked.

   652			afinfo->init_tempsel(&x->sel, fl);
   653	
   654		if (family != tmpl->encap_family) {
   655			afinfo = xfrm_state_afinfo_get_rcu(tmpl->encap_family);
   656			if (!afinfo)
   657				return;
   658		}
   659		afinfo->init_temprop(x, tmpl, daddr, saddr);
                ^^^^^^^^^^^^^^^^^^^^
Dereference.  Is it possible for "family = tmpl->encap_family" and
xfrm_state_afinfo_get_rcu() to return NULL?

   660	}
   661	

regards,
dan carpenter

                 reply	other threads:[~2017-01-13 13:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20170113131115.GA12283@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=kernel-janitors@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.