Re: [PATCH net 2/2] ipv4: make exception cache less predictible

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[ 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@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

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@xxxxxxxxxxxx




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux