[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <72a13f13-056a-be0a-a50a-4edc1cda87ad@csgroup.eu>
Date: Tue, 25 Jan 2022 17:11:20 +0000
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: Dan Carpenter <dan.carpenter@...cle.com>,
"kbuild@...ts.01.org" <kbuild@...ts.01.org>
CC: "lkp@...el.com" <lkp@...el.com>,
"kbuild-all@...ts.01.org" <kbuild-all@...ts.01.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Michael Ellerman <mpe@...erman.id.au>
Subject: Re: net/kcm/kcmsock.c:645 kcm_write_msgs() error: we previously
assumed 'psock' could be null (see line 585)
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@...el.com>
> Reported-by: Dan Carpenter <dan.carpenter@...cle.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
Powered by blists - more mailing lists