peterdelevoryas / rpms / qemu

Forked from rpms/qemu 2 years ago
Clone

Blame 0121-hw-wm8750-Fix-potential-buffer-overflow.patch

5544c1
From 044cadadb3bb63396a1e8d72a0c90673ccd7be98 Mon Sep 17 00:00:00 2001
5544c1
From: Stefan Weil <sw@weilnetz.de>
5544c1
Date: Mon, 3 Sep 2012 22:56:00 +0200
5544c1
Subject: [PATCH] hw/wm8750: Fix potential buffer overflow
5544c1
5544c1
Report from smatch:
5544c1
5544c1
hw/wm8750.c:369 wm8750_tx(12) error: buffer overflow 's->i2c_data' 2 <= 2
5544c1
5544c1
It looks like the preprocessor statements were simply misplaced.
5544c1
5544c1
Replace also __FUNCTION__ by __func__ to please checkpatch.pl.
5544c1
5544c1
Signed-off-by: Stefan Weil <sw@weilnetz.de>
5544c1
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5544c1
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
5544c1
(cherry picked from commit 149eeb5fe57b853081e8059575d91b8a58a4f96c)
5544c1
5544c1
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5544c1
---
5544c1
 hw/wm8750.c | 4 ++--
5544c1
 1 file changed, 2 insertions(+), 2 deletions(-)
5544c1
5544c1
diff --git a/hw/wm8750.c b/hw/wm8750.c
5544c1
index 11bcec3..44f138f 100644
5544c1
--- a/hw/wm8750.c
5544c1
+++ b/hw/wm8750.c
5544c1
@@ -361,10 +361,10 @@ static int wm8750_tx(I2CSlave *i2c, uint8_t data)
5544c1
     uint16_t value;
5544c1
 
5544c1
     if (s->i2c_len >= 2) {
5544c1
-        printf("%s: long message (%i bytes)\n", __FUNCTION__, s->i2c_len);
5544c1
 #ifdef VERBOSE
5544c1
-        return 1;
5544c1
+        printf("%s: long message (%i bytes)\n", __func__, s->i2c_len);
5544c1
 #endif
5544c1
+        return 1;
5544c1
     }
5544c1
     s->i2c_data[s->i2c_len ++] = data;
5544c1
     if (s->i2c_len != 2)
5544c1
-- 
5544c1
1.7.12.1
5544c1