kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH net 2/2] ipv4: make exception cache less predictible
       [not found] <20210829221615.2057201-3-eric.dumazet@gmail.com>
@ 2021-08-30 11:34 ` Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2021-08-30 11:34 UTC (permalink / raw)
  To: kbuild, Eric Dumazet, kernel-janitors; +Cc: lkp, kbuild-all

[ I trimmed the CC list because this is probably a false positive and
  netdev hates static checker warnings.  - dan ]

Hi Eric,

url:    https://github.com/0day-ci/linux/commits/Eric-Dumazet/inet-make-exception-handling-less-predictible/20210830-061726
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 57f780f1c43362b86fd23d20bd940e2468237716
config: x86_64-randconfig-m001-20210829 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
net/ipv4/route.c:606 fnhe_remove_oldest() error: potentially dereferencing uninitialized 'oldest_p'.

vim +/oldest_p +606 net/ipv4/route.c

adf305d00ec06cb Eric Dumazet    2021-08-29  589  static void fnhe_remove_oldest(struct fnhe_hash_bucket *hash)
4895c771c7f006b David S. Miller 2012-07-17  590  {
adf305d00ec06cb Eric Dumazet    2021-08-29  591  	struct fib_nh_exception __rcu **fnhe_p, **oldest_p;
adf305d00ec06cb Eric Dumazet    2021-08-29  592  	struct fib_nh_exception *fnhe, *oldest = NULL;
4895c771c7f006b David S. Miller 2012-07-17  593  
adf305d00ec06cb Eric Dumazet    2021-08-29  594  	for (fnhe_p = &hash->chain; ; fnhe_p = &fnhe->fnhe_next) {
adf305d00ec06cb Eric Dumazet    2021-08-29  595  		fnhe = rcu_dereference_protected(*fnhe_p,
adf305d00ec06cb Eric Dumazet    2021-08-29  596  						 lockdep_is_held(&fnhe_lock));
adf305d00ec06cb Eric Dumazet    2021-08-29  597  		if (!fnhe)
adf305d00ec06cb Eric Dumazet    2021-08-29  598  			break;

Smatch is complaining that this could break on the first iteration
through the loop...

adf305d00ec06cb Eric Dumazet    2021-08-29  599  		if (!oldest ||
adf305d00ec06cb Eric Dumazet    2021-08-29  600  		    time_before(fnhe->fnhe_stamp, oldest->fnhe_stamp)) {
4895c771c7f006b David S. Miller 2012-07-17  601  			oldest = fnhe;
adf305d00ec06cb Eric Dumazet    2021-08-29  602  			oldest_p = fnhe_p;
adf305d00ec06cb Eric Dumazet    2021-08-29  603  		}
4895c771c7f006b David S. Miller 2012-07-17  604  	}
2ffae99d1fac272 Timo Teräs      2013-06-27  605  	fnhe_flush_routes(oldest);
adf305d00ec06cb Eric Dumazet    2021-08-29 @606  	*oldest_p = oldest->fnhe_next;
adf305d00ec06cb Eric Dumazet    2021-08-29  607  	kfree_rcu(oldest, rcu);
4895c771c7f006b David S. Miller 2012-07-17  608  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


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

only message in thread, other threads:[~2021-08-30 11:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210829221615.2057201-3-eric.dumazet@gmail.com>
2021-08-30 11:34 ` [PATCH net 2/2] ipv4: make exception cache less predictible Dan Carpenter

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