* [Qemu-devel] [PATCH] hw/wm8750: Fix potential buffer overflow
@ 2012-09-03 20:56 Stefan Weil
2012-09-03 22:14 ` Peter Maydell
2012-09-10 13:17 ` Aurelien Jarno
0 siblings, 2 replies; 3+ messages in thread
From: Stefan Weil @ 2012-09-03 20:56 UTC (permalink / raw)
To: Andrzej Zaborowski; +Cc: Stefan Weil, qemu-devel
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>
---
hw/wm8750.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/wm8750.c b/hw/wm8750.c
index 11bcec3..44f138f 100644
--- a/hw/wm8750.c
+++ b/hw/wm8750.c
@@ -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)
--
1.7.10
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/wm8750: Fix potential buffer overflow
2012-09-03 20:56 [Qemu-devel] [PATCH] hw/wm8750: Fix potential buffer overflow Stefan Weil
@ 2012-09-03 22:14 ` Peter Maydell
2012-09-10 13:17 ` Aurelien Jarno
1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2012-09-03 22:14 UTC (permalink / raw)
To: Stefan Weil; +Cc: Andrzej Zaborowski, qemu-devel
On 3 September 2012 21:56, Stefan Weil <sw@weilnetz.de> wrote:
> 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>
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/wm8750: Fix potential buffer overflow
2012-09-03 20:56 [Qemu-devel] [PATCH] hw/wm8750: Fix potential buffer overflow Stefan Weil
2012-09-03 22:14 ` Peter Maydell
@ 2012-09-10 13:17 ` Aurelien Jarno
1 sibling, 0 replies; 3+ messages in thread
From: Aurelien Jarno @ 2012-09-10 13:17 UTC (permalink / raw)
To: Stefan Weil; +Cc: Andrzej Zaborowski, qemu-devel
On Mon, Sep 03, 2012 at 10:56:00PM +0200, Stefan Weil wrote:
> 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>
> ---
> hw/wm8750.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/wm8750.c b/hw/wm8750.c
> index 11bcec3..44f138f 100644
> --- a/hw/wm8750.c
> +++ b/hw/wm8750.c
> @@ -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)
> --
> 1.7.10
>
Thanks, applied.
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-09-10 13:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-03 20:56 [Qemu-devel] [PATCH] hw/wm8750: Fix potential buffer overflow Stefan Weil
2012-09-03 22:14 ` Peter Maydell
2012-09-10 13:17 ` Aurelien Jarno
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.