Skip to contentSkip to conversation

sm501: Fix size of color_reg

PATCH Applied Stefan Weil 2 participants 2 messages Jan 7, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sm501: Fix size of color_reg

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 <[email protected]>
---
 hw/sm501.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/sm501.c +1 -1
index 326531c..09c5894 100644
@@ -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) {
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 9 lines · Stefan Weil

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 '&'.

Quoted 6 lines
Cc Shin-ichiro Kawasaki <[email protected]>
---
 hw/sm501.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Thanks, applied.

Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net