Re: [PATCH v2] xfs: fix an undefined behaviour in _da3_path_shift

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

 



On Tue, Feb 25, 2020 at 04:55:56PM -0500, Qian Cai wrote:
> 
> 
> > On Feb 25, 2020, at 4:40 PM, Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:
> > 
> > In xfs_da3_path_shift() blk can be assigned to state->path.blk[-1] if
> > state->path.active is 1 (which is a valid state) when it tries to add an
> > entry > to a single dir leaf block and then to shift forward to see if
> > there's a sibling block that would be a better place to put the new
> > entry.  This causes a KASAN warning given
> 
> s/KASAN/UBSAN/
> 
> > negative array indices are
> > undefined behavior in C.  In practice the warning is entirely harmless
> > given that blk is never dereference in this case, but it is still better
> > to fix up the warning and slightly improve the code.
> 
> Agree. This is better.
> 
> Darrick, do you need me to send a v3 for it or you could squash this in?

Please send a v3.  The code in v2 looked fine to me.

--D



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux