Re: [PATCH] RISC-V: KVM: Fix shift-out-of-bounds in make_xfence_request()

From: Jiakai Xu

Date: Fri Apr 03 2026 - 19:08:54 EST


> idx is unsigned, so I would expect this 'idx < 0' to produce a warning
> that it's always false.
>
> I wouldn't introduce idx and just change the current condition instead
>
> if (vcpu->vcpu_id < hbase || vcpu->vcpu_id >= hbase + BITS_PER_LONG)
> continue;

Thanks for the review!

You're right, the 'idx < 0' check is redundant since idx is unsigned.
Will drop the idx variable and use your suggested condition directly.

Will send a v2 shortly.

Thanks,
Jiakai