Received: from eggs.gnu.org ([2001:4830:134:3::10]:36720) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXRr2-0008Gv-FB for qemu-devel@nongnu.org; Mon, 16 Mar 2015 06:02:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YXRqr-0002dU-3A for qemu-devel@nongnu.org; Mon, 16 Mar 2015 06:02:36 -0400 Received: from e06smtp10.uk.ibm.com ([195.75.94.106]:55321) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YXRqq-0002d8-NA for qemu-devel@nongnu.org; Mon, 16 Mar 2015 06:02:24 -0400 Received: from /spool/local by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 16 Mar 2015 10:02:21 -0000 Date: Mon, 16 Mar 2015 11:02:18 +0100 From: Thomas Huth Message-ID: <20150316110218.7b754f4f@oc7435384737.ibm.com> In-Reply-To: <1426347721-8349-1-git-send-email-sw@weilnetz.de> References: <1426347721-8349-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: Add missing error handling for call of lseek 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 16:42:01 +0100 Stefan Weil wrote: > This fixes a warning from Coverity. > > Signed-off-by: Stefan Weil > --- > include/hw/elf_ops.h | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/include/hw/elf_ops.h b/include/hw/elf_ops.h > index 16a627b..bd71968 100644 > --- a/include/hw/elf_ops.h > +++ b/include/hw/elf_ops.h > @@ -315,7 +315,9 @@ static int glue(load_elf, SZ)(const char *name, int fd, > glue(load_symbols, SZ)(&ehdr, fd, must_swab, clear_lsb); > > size = ehdr.e_phnum * sizeof(phdr[0]); > - lseek(fd, ehdr.e_phoff, SEEK_SET); > + if (lseek(fd, ehdr.e_phoff, SEEK_SET) != ehdr.e_phoff) { > + goto fail; > + } > phdr = g_malloc0(size); > if (!phdr) > goto fail; Looks good. Reviewed-by: Thomas Huth