From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44750) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vr1Y2-0004sK-Bz for qemu-devel@nongnu.org; Thu, 12 Dec 2013 03:23:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vr1Xx-0002YC-Ex for qemu-devel@nongnu.org; Thu, 12 Dec 2013 03:23:06 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52570) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vr1Xx-0002Y8-79 for qemu-devel@nongnu.org; Thu, 12 Dec 2013 03:23:01 -0500 Date: Thu, 12 Dec 2013 09:22:57 +0100 From: Stefan Hajnoczi Message-ID: <20131212082257.GE13302@stefanha-thinkpad.redhat.com> References: <1386794231-18119-1-git-send-email-sw@weilnetz.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1386794231-18119-1-git-send-email-sw@weilnetz.de> Subject: Re: [Qemu-devel] [PATCH] block/vvfat: Fix compiler warnings for OpenBSD List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Weil Cc: Kevin Wolf , qemu-devel On Wed, Dec 11, 2013 at 09:37:11PM +0100, Stefan Weil wrote: > The buildbot shows these compiler warnings: > > block/vvfat.c: In function 'create_short_and_long_name': > block/vvfat.c:620: warning: array size (8) smaller than bound length (11) > block/vvfat.c:620: warning: array size (8) smaller than bound length (11) > block/vvfat.c:635: warning: array size (8) smaller than bound length (11) > block/vvfat.c:635: warning: array size (8) smaller than bound length (11) > > They are caused by tricky code where 8 characters for the name are followed > by 3 characters for the extension, and some operations touch both name and > extension. > > Using an 11 character name which includes the extension fixes the compiler > warning, satisfies cppcheck, valgrind and maybe other static and dynamic > code checkers, and even simplifies some parts of the code. > > Signed-off-by: Stefan Weil > --- > block/vvfat.c | 43 ++++++++++++++++++++++--------------------- > 1 file changed, 22 insertions(+), 21 deletions(-) Reviewed-by: Stefan Hajnoczi