Re: [PATCH v2] Drivers: hv: mshv: fix integer overflow in memory region overlap check

From: Junrui Luo

Date: Thu Apr 09 2026 - 23:07:09 EST


On Thu, Apr 02, 2026 at 04:25:02PM -0700, Stanislav Kinsburskii wrote:
> nit: both comments are redundant - the meaning is clear from the code
> itself.

I will drop them in v3.

> This maximum value check bugs me a bit.
>
> First of all, why does it matter what is the region end? Potentially, there can be
> regions not backed by host address space (leave alone host RAM), so why
> intropducing this limitation?
>
> Second, this check takes a host-specific constant (MAX_PHYSMEM_BITS) and rounds it down
> to hypervisor-specific units which may not be aligned with the host page
> size. Should this be host pages instead?

This check was suggested by Roman in v1 review. Roman, could you
share your thoughts on Stanislav's concerns? I'd like to align on whether an upper
bound check is needed here.

Thanks,
Junrui Luo