All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: "Alvin Šipraga" <ALSI@bang-olufsen.dk>
Cc: kernel test robot <lkp@intel.com>,
	"oe-kbuild@lists.linux.dev" <oe-kbuild@lists.linux.dev>
Subject: Re: drivers/net/dsa/realtek/rtl8365mb.c:1349 rtl8365mb_stats_update() error: uninitialized symbol 'ret'.
Date: Thu, 3 Nov 2022 14:17:01 +0300	[thread overview]
Message-ID: <Y2OjLbDSB45XAjLC@kadam> (raw)
In-Reply-To: <20221103110429.ehsswxabce3dqky3@bang-olufsen.dk>

On Thu, Nov 03, 2022 at 11:04:30AM +0000, Alvin Šipraga wrote:
> Hi,
> 
> On Sat, Oct 29, 2022 at 04:01:24PM +0800, kernel test robot wrote:
> > BCC: lkp@intel.com
> > CC: oe-kbuild-all@lists.linux.dev
> > CC: linux-kernel@vger.kernel.org
> > TO: Luiz Angelo Daros de Luca <luizluca@gmail.com>
> > CC: "Alvin Šipraga" <alsi@bang-olufsen.dk>
> > CC: Linus Walleij <linus.walleij@linaro.org>
> > CC: Florian Fainelli <f.fainelli@gmail.com>
> > CC: Vladimir Oltean <olteanv@gmail.com>
> > 
> > Hi Luiz,
> > 
> > First bad commit (maybe != root cause):
> > 
> > tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > head:   576e61cea1e4b66f52f164dee0edbe4b1c999997
> > commit: 319a70a5fea9590e9431dd57f56191996c4787f4 net: dsa: realtek-smi: move to subdirectory
> > date:   9 months ago
> > :::::: branch date: 8 hours ago
> > :::::: commit date: 9 months ago
> > config: microblaze-randconfig-m041-20221027
> > compiler: microblaze-linux-gcc (GCC) 12.1.0
> > 
> > If you fix the issue, kindly add following tag where applicable
> > | Reported-by: kernel test robot <lkp@intel.com>
> > | Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> This is a false-positive, but smatch can be forgiven for not noticing
> it. How can I prevent this from showing up again? Thanks!
> 

Yeah, Smatch thinks you might be able to hit the continue on every
iteration through the loop.

kbuild warnings used to only show up once but now it seems you get
periodic reminders.  You also seem to have subscribed to the unfiltered
warnings.  I already had looked at this one and didn't forward it
because it's a false positive.  So most people would not have seen this
false postive.

Also I should probably ask the kbuild devs to change my email to
<error27@gmail.com> because I'm no longer at Oracle.  My script
converts it automatically for forwarded emails.

> >   1334  	for (i = 0; i < RTL8365MB_MIB_END; i++) {
> >   1335  		struct rtl8365mb_mib_counter *c = &rtl8365mb_mib_counters[i];
> >   1336  
> >   1337  		/* Only fetch required MIB counters (marked = 1 above) */
> >   1338  		if (!cnt[i])
> >   1339  			continue;
> >   1340  
> >   1341  		ret = rtl8365mb_mib_counter_read(smi, port, c->offset,
> >   1342  						 c->length, &cnt[i]);
> >   1343  		if (ret)
> >   1344  			break;
> >   1345  	}
> >   1346  	mutex_unlock(&mb->mib_lock);
> >   1347  
> >   1348  	/* Don't update statistics if there was an error reading the counters */
> >  @1349  	if (ret)
> >   1350  		return;


Loops are a tricky thing.  I could make it an assumption for this
"uninitialized variable" test that every loop goes through one time and
avoids all the continues...  They are mostly false positives.

regards,
dan carpenter


  reply	other threads:[~2022-11-03 11:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-29  8:01 drivers/net/dsa/realtek/rtl8365mb.c:1349 rtl8365mb_stats_update() error: uninitialized symbol 'ret' kernel test robot
2022-11-03 11:04 ` Alvin Šipraga
2022-11-03 11:17   ` Dan Carpenter [this message]
2022-11-03 11:28     ` Alvin Šipraga
  -- strict thread matches above, loose matches on Subject: below --
2023-01-20  0:02 kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y2OjLbDSB45XAjLC@kadam \
    --to=error27@gmail.com \
    --cc=ALSI@bang-olufsen.dk \
    --cc=lkp@intel.com \
    --cc=oe-kbuild@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.