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

Re: [Coverity complaint] Re: [PATCH v5] pdx: introduce a new compression algorithm based on region offsets



On Wed, Aug 13, 2025 at 12:47:37PM +0100, Andrew Cooper wrote:
> On 12/08/2025 4:06 pm, Roger Pau Monne wrote:
> > Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> 
> Not this patch, but this is probably the best place to report it.
> 
> https://scan5.scan.coverity.com/#/project-view/30554/10426?selectedIssue=1662707
> 
> Something you did in the series made enough changes in
> pfn_pdx_compression_setup() for Coverity to start reporting an issue in
> some decade-old code.
> 
> The complaint is on line:
> 
> 277    ma_va_bottom_mask   = (PAGE_SIZE << bottom_shift) - 1;
> CID 1662707: (#1 of 1): Bad bit shift operation (BAD_SHIFT)
> 
> 34. large_shift: In expression 0x1000 << bottom_shift, left shifting by more 
> than 31 bits
> has undefined behavior. The shift amount, bottom_shift, is as much as 63.
> 
> 
> The relevant part of earlier analysis seems to be the "i >=
> BITS_PER_LONG" check in the order loop, causing Coverity to think that i
> can be up to 63.

Yes, I've also got the email.  This is existing code, so the issue
wasn't introduced by the previous patches, it's probably result of
the code movement that Coverity picked it up.

I will send a patch to fix this.

Thanks, Roger.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.