The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Purva Yeshi <purvayeshi550@gmail.com>
To: David Ahern <dsahern@kernel.org>, Kuniyuki Iwashima <kuniyu@amazon.com>
Cc: davem@davemloft.net, edumazet@google.com, horms@kernel.org,
	kuba@kernel.org, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, pabeni@redhat.com
Subject: Re: [PATCH] net: ipv4: Fix uninitialized pointer warning in fnhe_remove_oldest
Date: Fri, 18 Apr 2025 15:16:53 +0530	[thread overview]
Message-ID: <9220c4b5-ba0c-4bfe-a6d0-5b52631f4ad8@gmail.com> (raw)
In-Reply-To: <b137f4c6-9cbd-456d-b839-bc77d6ef9079@kernel.org>

On 18/04/25 10:33, David Ahern wrote:
> On 4/17/25 4:00 PM, Kuniyuki Iwashima wrote:
>> From: Purva Yeshi <purvayeshi550@gmail.com>
>> Date: Thu, 17 Apr 2025 15:11:26 +0530
>>> Fix Smatch-detected issue:
>>> net/ipv4/route.c:605 fnhe_remove_oldest() error:
>>> uninitialized symbol 'oldest_p'.
>>>
>>> Initialize oldest_p to NULL to avoid uninitialized pointer warning in
>>> fnhe_remove_oldest.
>>
>> How does it remain uninitialised ?
>>
>> update_or_create_fnhe() ensures the bucket is not empty before
>> calling fnhe_remove_oldest().
>>
> 
> agreed. Not the simplest logic, but I do not see how oldest_p can be
> unset after the loop.

Hi David,

The loop always sets oldest_p when the list has at least one entry, 
which the caller guarantees. Smatch doesn't catch that context, so it 
flags a false positive.

Best regards,
Purva


  reply	other threads:[~2025-04-18  9:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-17  9:41 [PATCH] net: ipv4: Fix uninitialized pointer warning in fnhe_remove_oldest Purva Yeshi
2025-04-17 22:00 ` Kuniyuki Iwashima
2025-04-18  5:03   ` David Ahern
2025-04-18  9:46     ` Purva Yeshi [this message]
2025-04-18  9:31   ` Purva Yeshi

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=9220c4b5-ba0c-4bfe-a6d0-5b52631f4ad8@gmail.com \
    --to=purvayeshi550@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuniyu@amazon.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox