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

Re: [XEN PATCH] xen/vpci: Fix UB in mask_write



On Wed, Nov 06, 2024 at 10:00:07AM +0100, Roger Pau Monné wrote:
> On Wed, Nov 06, 2024 at 08:05:19AM +0000, Mykyta Poturai wrote:
> > During the construction of dmask value, it gets shifted by
> > (32 - msi->vectors) bits. If msi->vectors is 0, the result of the shift
> > becomes undefined due to shifting by a size of the type. While this
> > works fine on x86, on ARM the resulting mask becomes 0xFFFFFFFF, which
> > is incorrect.
> > 
> > Fix this by adding an explicit check for msi->vectors == 0.

Wait - how can msi->vectors ever be 0?  AFAICT there's no way in the
MSI logic to configure 0 vectors, there will always be at least 1 vector
enabled.

Maybe what you want, if this fix is for compliance reasons, is an
assert unreachable that msi->vectors > 0?

Thanks, Roger.



 


Rackspace

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