Received: from eggs.gnu.org ([208.118.235.92]:40678) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TB3s1-0003G2-QH for qemu-devel@nongnu.org; Mon, 10 Sep 2012 09:17:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TB3rt-0000Tu-Kd for qemu-devel@nongnu.org; Mon, 10 Sep 2012 09:17:45 -0400 Received: from hall.aurel32.net ([88.191.126.93]:33465) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TB3rt-0000Th-EK for qemu-devel@nongnu.org; Mon, 10 Sep 2012 09:17:37 -0400 Date: Mon, 10 Sep 2012 15:17:30 +0200 From: Aurelien Jarno Message-ID: <20120910131730.GT6791@ohm.aurel32.net> References: <1346705760-11648-1-git-send-email-sw@weilnetz.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <1346705760-11648-1-git-send-email-sw@weilnetz.de> Subject: Re: [Qemu-devel] [PATCH] hw/wm8750: Fix potential buffer overflow List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Weil Cc: Andrzej Zaborowski , qemu-devel@nongnu.org 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 > --- > 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