ati-vga: Add upper limit to x-linear-aper-size property

Coverity warns in CID 1645968 about possible integer overflow. This
should never happen but to ensure that, add an upper limit on the
x-linear-aper-size. This may not silence the warning but makes sure
users cannot cause an overflow.

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <541ffffdaa4c67b9dcbca6c2498e69b137bce95d.1774904832.git.balaton@eik.bme.hu>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
BALATON Zoltan
2026-03-30 23:09:17 +02:00
committed by Philippe Mathieu-Daudé
parent 3b4acaf9e6
commit 6af42f7c50

View File

@@ -1130,6 +1130,10 @@ static void ati_vga_realize(PCIDevice *dev, Error **errp)
s->linear_aper_sz = ATI_R100_LINEAR_APER_SIZE;
}
}
if (s->linear_aper_sz > 256 * MiB) {
error_setg(errp, "x-linear-aper-size is too large (maximum 256 MiB)");
return;
}
if (s->linear_aper_sz < 16 * MiB) {
error_setg(errp, "x-linear-aper-size is too small (minimum 16 MiB)");
return;