mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* net/kcm/kcmsock.c:645 kcm_write_msgs() error: we previously assumed 'psock' could be null (see line 585)
@ 2022-01-25 14:47 Dan Carpenter
  2022-01-25 17:11 ` Christophe Leroy
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2022-01-25 14:47 UTC (permalink / raw)
  To: kbuild, Christophe Leroy; +Cc: lkp, kbuild-all, linux-kernel, Michael Ellerman

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   9b57f458985742bd1c585f4c7f36d04634ce1143
commit: 1e688dd2a3d6759d416616ff07afc4bb836c4213 powerpc/bug: Provide better flexibility to WARN_ON/__WARN_FLAGS() with asm goto
config: powerpc64-randconfig-m031-20220120 (https://download.01.org/0day-ci/archive/20220122/202201220354.fJ3VzqBt-lkp@intel.com/config)
compiler: powerpc64-linux-gcc (GCC) 11.2.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/kcm/kcmsock.c:645 kcm_write_msgs() error: we previously assumed 'psock' could be null (see line 585)

vim +/psock +645 net/kcm/kcmsock.c

ab7ac4eb9832e32 Tom Herbert             2016-03-07  589  		unreserve_psock(kcm);
cd6e111bf5be5c7 Tom Herbert             2016-03-07  590  		kcm_report_tx_retry(kcm);
ab7ac4eb9832e32 Tom Herbert             2016-03-07  591  		if (skb_queue_empty(&sk->sk_write_queue))
ab7ac4eb9832e32 Tom Herbert             2016-03-07  592  			return 0;
ab7ac4eb9832e32 Tom Herbert             2016-03-07  593  
ab7ac4eb9832e32 Tom Herbert             2016-03-07  594  		kcm_tx_msg(skb_peek(&sk->sk_write_queue))->sent = 0;
ab7ac4eb9832e32 Tom Herbert             2016-03-07  595  
ab7ac4eb9832e32 Tom Herbert             2016-03-07  596  	} else if (skb_queue_empty(&sk->sk_write_queue)) {
ab7ac4eb9832e32 Tom Herbert             2016-03-07  597  		return 0;
ab7ac4eb9832e32 Tom Herbert             2016-03-07  598  	}
ab7ac4eb9832e32 Tom Herbert             2016-03-07  599  
ab7ac4eb9832e32 Tom Herbert             2016-03-07  600  	head = skb_peek(&sk->sk_write_queue);
ab7ac4eb9832e32 Tom Herbert             2016-03-07  601  	txm = kcm_tx_msg(head);
ab7ac4eb9832e32 Tom Herbert             2016-03-07  602  
ab7ac4eb9832e32 Tom Herbert             2016-03-07  603  	if (txm->sent) {
ab7ac4eb9832e32 Tom Herbert             2016-03-07  604  		/* Send of first skbuff in queue already in progress */
ab7ac4eb9832e32 Tom Herbert             2016-03-07  605  		if (WARN_ON(!psock)) {

This warning is a false positive.

The new Power PC implementation of WARN_ON() is written in asm and
Smatch can only parse C.  I don't have a cross compile system set up so
fixing this is going to be a big headache.  :/

ab7ac4eb9832e32 Tom Herbert             2016-03-07  606  			ret = -EINVAL;
ab7ac4eb9832e32 Tom Herbert             2016-03-07  607  			goto out;
ab7ac4eb9832e32 Tom Herbert             2016-03-07  608  		}
ab7ac4eb9832e32 Tom Herbert             2016-03-07  609  		sent = txm->sent;
ab7ac4eb9832e32 Tom Herbert             2016-03-07  610  		frag_offset = txm->frag_offset;
ab7ac4eb9832e32 Tom Herbert             2016-03-07  611  		fragidx = txm->fragidx;
ab7ac4eb9832e32 Tom Herbert             2016-03-07  612  		skb = txm->frag_skb;
ab7ac4eb9832e32 Tom Herbert             2016-03-07  613  
ab7ac4eb9832e32 Tom Herbert             2016-03-07  614  		goto do_frag;
ab7ac4eb9832e32 Tom Herbert             2016-03-07  615  	}

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: net/kcm/kcmsock.c:645 kcm_write_msgs() error: we previously assumed 'psock' could be null (see line 585)
  2022-01-25 14:47 net/kcm/kcmsock.c:645 kcm_write_msgs() error: we previously assumed 'psock' could be null (see line 585) Dan Carpenter
@ 2022-01-25 17:11 ` Christophe Leroy
  0 siblings, 0 replies; 2+ messages in thread
From: Christophe Leroy @ 2022-01-25 17:11 UTC (permalink / raw)
  To: Dan Carpenter, kbuild; +Cc: lkp, kbuild-all, linux-kernel, Michael Ellerman



Le 25/01/2022 à 15:47, Dan Carpenter a écrit :
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   9b57f458985742bd1c585f4c7f36d04634ce1143
> commit: 1e688dd2a3d6759d416616ff07afc4bb836c4213 powerpc/bug: Provide better flexibility to WARN_ON/__WARN_FLAGS() with asm goto
> config: powerpc64-randconfig-m031-20220120 (https://download.01.org/0day-ci/archive/20220122/202201220354.fJ3VzqBt-lkp@intel.com/config)
> compiler: powerpc64-linux-gcc (GCC) 11.2.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/kcm/kcmsock.c:645 kcm_write_msgs() error: we previously assumed 'psock' could be null (see line 585)
> 
> vim +/psock +645 net/kcm/kcmsock.c
> 
> ab7ac4eb9832e32 Tom Herbert             2016-03-07  589  		unreserve_psock(kcm);
> cd6e111bf5be5c7 Tom Herbert             2016-03-07  590  		kcm_report_tx_retry(kcm);
> ab7ac4eb9832e32 Tom Herbert             2016-03-07  591  		if (skb_queue_empty(&sk->sk_write_queue))
> ab7ac4eb9832e32 Tom Herbert             2016-03-07  592  			return 0;
> ab7ac4eb9832e32 Tom Herbert             2016-03-07  593
> ab7ac4eb9832e32 Tom Herbert             2016-03-07  594  		kcm_tx_msg(skb_peek(&sk->sk_write_queue))->sent = 0;
> ab7ac4eb9832e32 Tom Herbert             2016-03-07  595
> ab7ac4eb9832e32 Tom Herbert             2016-03-07  596  	} else if (skb_queue_empty(&sk->sk_write_queue)) {
> ab7ac4eb9832e32 Tom Herbert             2016-03-07  597  		return 0;
> ab7ac4eb9832e32 Tom Herbert             2016-03-07  598  	}
> ab7ac4eb9832e32 Tom Herbert             2016-03-07  599
> ab7ac4eb9832e32 Tom Herbert             2016-03-07  600  	head = skb_peek(&sk->sk_write_queue);
> ab7ac4eb9832e32 Tom Herbert             2016-03-07  601  	txm = kcm_tx_msg(head);
> ab7ac4eb9832e32 Tom Herbert             2016-03-07  602
> ab7ac4eb9832e32 Tom Herbert             2016-03-07  603  	if (txm->sent) {
> ab7ac4eb9832e32 Tom Herbert             2016-03-07  604  		/* Send of first skbuff in queue already in progress */
> ab7ac4eb9832e32 Tom Herbert             2016-03-07  605  		if (WARN_ON(!psock)) {
> 
> This warning is a false positive.
> 
> The new Power PC implementation of WARN_ON() is written in asm and
> Smatch can only parse C.  I don't have a cross compile system set up so
> fixing this is going to be a big headache.  :/

Can you explain what the problem is ?

Yes psock could be NULL, that the reason why there is this WARN_ON(), 
isn't it ?
So what does smatch doesn't like here ?

How do I install smatch and how do I use it to reproduce that ?

Is it like sparse, does it set the __CHECKER__ macro ? Would it work if 
we do a simplified C version of WARN_ON() when __CHECKER__ is defined ?

Thanks
Christophe

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-25 17:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-25 14:47 net/kcm/kcmsock.c:645 kcm_write_msgs() error: we previously assumed 'psock' could be null (see line 585) Dan Carpenter
2022-01-25 17:11 ` Christophe Leroy

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

Powered by JetHome