Re: [PATCH] pNFS: fix uninitialized pointer access

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

 



Hi Antonio, Dan,

I have an idea how to refactor the code a little to make the static
analyzer happy. Will send a patch soon, but first I want to check
that it won't affect functionality.

On Thu, Jul 17, 2025 at 10:01:42AM +0200, Antonio Quartulli wrote:
> On 17/07/2025 06:56, Dan Carpenter wrote:
> > No, it won't.  I feel like the code is confusing enough that maybe a
> > comment is warranted.  /* We always iterate through the loop at least
> > once so be_prev is correct. */
> >
>
> I agree a comment would help.

I see, will add a comment.

> > Another option would be to initialize the be_prev to NULL.  This will
> > silence the uninitialized variable warning.
>
> But will likely trigger a potential NULL-ptr-deref, because the static
> analyzer believes we can get there with count==0.

I agree, this will most likely result in another warning.

--
Sergey Bashirov




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux