public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [bug report] xfrm: add and use xfrm_state_afinfo_get_rcu
@ 2017-01-13 13:11 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2017-01-13 13:11 UTC (permalink / raw)
  To: kernel-janitors

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-01-13 13:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-13 13:11 [bug report] xfrm: add and use xfrm_state_afinfo_get_rcu Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox