]> git.proxmox.com Git - mirror_qemu.git/commitdiff
hw/wm8750: Fix potential buffer overflow
authorStefan Weil <sw@weilnetz.de>
Mon, 3 Sep 2012 20:56:00 +0000 (22:56 +0200)
committerAurelien Jarno <aurelien@aurel32.net>
Mon, 10 Sep 2012 12:59:47 +0000 (14:59 +0200)
Report from smatch:

hw/wm8750.c:369 wm8750_tx(12) error: buffer overflow 's->i2c_data' 2 <= 2

It looks like the preprocessor statements were simply misplaced.

Replace also __FUNCTION__ by __func__ to please checkpatch.pl.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
hw/wm8750.c

index 11bcec34106ee99145d09ffcdf9c4c1ada61484f..44f138fd51dc5927889f7f143f7065bacd9113ee 100644 (file)
@@ -361,10 +361,10 @@ static int wm8750_tx(I2CSlave *i2c, uint8_t data)
     uint16_t value;
 
     if (s->i2c_len >= 2) {
-        printf("%s: long message (%i bytes)\n", __FUNCTION__, s->i2c_len);
 #ifdef VERBOSE
-        return 1;
+        printf("%s: long message (%i bytes)\n", __func__, s->i2c_len);
 #endif
+        return 1;
     }
     s->i2c_data[s->i2c_len ++] = data;
     if (s->i2c_len != 2)