From patchwork Thu Mar 19 09:05:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 451811 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 2A9B31400D5 for ; Thu, 19 Mar 2015 20:43:24 +1100 (AEDT) Received: from localhost ([::1]:38034 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYWz4-00045t-Ap for incoming@patchwork.ozlabs.org; Thu, 19 Mar 2015 05:43:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41877) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYWyU-0002un-4i for qemu-devel@nongnu.org; Thu, 19 Mar 2015 05:42:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YYWyM-0001lt-Rc for qemu-devel@nongnu.org; Thu, 19 Mar 2015 05:42:46 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:50197) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYWyM-0001lY-KH; Thu, 19 Mar 2015 05:42:38 -0400 Received: from tsrv.corpit.ru (tsrv.tls.msk.ru [192.168.177.2]) by isrv.corpit.ru (Postfix) with ESMTP id B150B41E51; Thu, 19 Mar 2015 12:42:36 +0300 (MSK) Received: from tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by tsrv.corpit.ru (Postfix) with SMTP id 2A13A943; Thu, 19 Mar 2015 12:05:48 +0300 (MSK) Received: (nullmailer pid 369 invoked by uid 1000); Thu, 19 Mar 2015 09:05:44 -0000 From: Michael Tokarev To: qemu-devel@nongnu.org Date: Thu, 19 Mar 2015 12:05:40 +0300 Message-Id: <6cbfb86f4c0ea7cbe852c7bc62a4ef523887c143.1426755483.git.mjt@msgid.tls.msk.ru> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 86.62.121.231 Cc: qemu-trivial@nongnu.org, Stefan Weil , Michael Tokarev Subject: [Qemu-devel] [PULL 22/24] elf-loader: Fix truncation warning from coverity X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Stefan Weil 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 Reviewed-by: Thomas Huth Signed-off-by: Michael Tokarev --- 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)