sm501: Do not allow guest to set invalid format

Prevent guest setting invalid format value that might trip checks in
sm501_2d_operation().

Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 26d4fa9b8ce81e2723e98d592ccba7550042752c.1592686588.git.balaton@eik.bme.hu
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
BALATON Zoltan 2020-06-20 22:56:28 +02:00 committed by Gerd Hoffmann
parent ba27110fab
commit f018edc358
1 changed files with 3 additions and 0 deletions

View File

@ -1503,6 +1503,9 @@ static void sm501_2d_engine_write(void *opaque, hwaddr addr,
s->twoD_background = value;
break;
case SM501_2D_STRETCH:
if (((value >> 20) & 3) == 3) {
value &= ~BIT(20);
}
s->twoD_stretch = value;
break;
case SM501_2D_COLOR_COMPARE: