Re: [PATCH] mm/damon/sysfs: eliminate potential uninitialized variable warning

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

 



On Mon, 6 Nov 2023 19:23:47 +0300 Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:

> On Mon, Nov 06, 2023 at 06:41:37AM -0800, SeongJae Park wrote:
> > Hi Dan,
> > 
> > On Mon, 6 Nov 2023 17:07:40 +0300 Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:
> > 
> > > The "err" variable is not initialized if damon_target_has_pid(ctx) is
> > > false and sys_target->regions->nr is zero.
> > 
> > Thank you for fixing this.  I actually noticed this issue from Coverity Weekly
> > Scan of -next tree (CID 1570878), and was about to send very same fix, but you
> > were faster :)
> > 
> > > 
> > > Fixes: 0bcd216c4741 ("mm/damon/sysfs: update monitoring target regions for online input commit")
> > 
> > Cc stable?
> > 
> 
> The fixes tag is from last week so I assumed it wasn't in stable yet.

You're right.  But the broken commit is a fix for stable trees, so I was
thinking this fix should also be merged into the stable kernel together.  I
think stable maintainers would do that on their own, but I wanted to make sure
by explicitly Cc-ing them.

> 
> Also to be honest, I wasn't totally positive this bug could occur in
> real life.

Again, you're right.  The uninitialized value can be returned to the caller,
but the caller of the function is not checking the returned value, so no real
problem can occur here.

But I think the unhandling of the return value is a bug itself, that not making
system crash like things but might make user confused, so I was preparing a
followup fix for that, too.  So, though the problem the fixes will fix are not
significant, I'd prefer merging this and the followup fix to stable trees if
ok, since those are anyway bug fix, and should be simple to apply.  If
something conflicts, I will provide backports.


Thanks,
SJ

> 
> regards,
> dan carpenter




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux