sm501: Fix size of color_reg
authorStefan Weil <sw@weilnetz.de>
Wed, 4 Jan 2012 21:50:09 +0000 (22:50 +0100)
committerAurelien Jarno <aurelien@aurel32.net>
Sat, 7 Jan 2012 20:29:26 +0000 (21:29 +0100)
color_reg is expected to hold 32 bit values, so it was too small.

This bug was reported by coverity:

hw/sm501.c:624:
result_independent_of_operands:
color_reg >> 16 is 0 regardless of the values of its operands.
This occurs as the bitwise first operand of '&'.

Cc: Shin-ichiro Kawasaki <kawasaki@juno.dti.ne.jp>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
hw/sm501.c

index 326531c57eb5a7841f4eb91060da477f399581cd..09c5894cf95ea91b22c52717921106952189db1c 100644 (file)
@@ -593,7 +593,7 @@ static inline uint32_t get_hwc_x(SM501State *state, int crt)
  */
 static inline uint16_t get_hwc_color(SM501State *state, int crt, int index)
 {
-    uint16_t color_reg = 0;
+    uint32_t color_reg = 0;
     uint16_t color_565 = 0;
 
     if (index == 0) {