On 06.11.2024 10:07, Roger Pau Monné wrote:
> 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?

Which raises a question as to (lack of) context: Was this spotted by
mere code inspection? Or by a static analyzer? If so, which one? That
may help figure whether some workaround like the one suggested is
necessary, or whether it can simply be left alone.

Jan

Reply via email to