Received: from eggs.gnu.org ([2001:4830:134:3::10]:59722) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXTXR-0008Uv-Cf for qemu-devel@nongnu.org; Mon, 16 Mar 2015 07:50:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YXTXN-0004Q1-W7 for qemu-devel@nongnu.org; Mon, 16 Mar 2015 07:50:29 -0400 Received: from e06smtp17.uk.ibm.com ([195.75.94.113]:38266) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXTXN-0004Po-Hl for qemu-devel@nongnu.org; Mon, 16 Mar 2015 07:50:25 -0400 Received: from /spool/local by e06smtp17.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 16 Mar 2015 11:50:23 -0000 Date: Mon, 16 Mar 2015 12:50:20 +0100 From: Thomas Huth Message-ID: <20150316125020.5da0ce16@oc7435384737.ibm.com> In-Reply-To: <1426322228-465-1-git-send-email-sw@weilnetz.de> References: <1426322228-465-1-git-send-email-sw@weilnetz.de> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] elf-loader: Fix truncation warning from coverity List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Weil Cc: QEMU Trivial , QEMU Developer On Sat, 14 Mar 2015 09:37:08 +0100 Stefan Weil wrote: > Coverity reports a truncation due to cast operation on operand > reltab->sh_size from 64 bits to 32 bits for calls of load_at. > > Fix the types of the function arguments to match their use in > function load_at: the offset is used for lseek which takes an > off_t parameter, the size is used for g_malloc and read. > > Signed-off-by: Stefan Weil > --- > hw/core/loader.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/core/loader.c b/hw/core/loader.c > index 76d8aca..d4c441f 100644 > --- a/hw/core/loader.c > +++ b/hw/core/loader.c > @@ -267,7 +267,7 @@ int load_aout(const char *filename, hwaddr addr, int max_sz, > > /* ELF loader */ > > -static void *load_at(int fd, int offset, int size) > +static void *load_at(int fd, off_t offset, size_t size) > { > void *ptr; > if (lseek(fd, offset, SEEK_SET) < 0) Sounds reasonable. Reviewed-by: Thomas Huth