From: Thomas Huth <thuth@linux.vnet.ibm.com>
To: Stefan Weil <sw@weilnetz.de>
Cc: QEMU Trivial <qemu-trivial@nongnu.org>,
QEMU Developer <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] elf-loader: Fix truncation warning from coverity
Date: Mon, 16 Mar 2015 12:50:20 +0100 [thread overview]
Message-ID: <20150316125020.5da0ce16@oc7435384737.ibm.com> (raw)
In-Reply-To: <1426322228-465-1-git-send-email-sw@weilnetz.de>
On Sat, 14 Mar 2015 09:37:08 +0100
Stefan Weil <sw@weilnetz.de> 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 <sw@weilnetz.de>
> ---
> 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 <thuth@linux.vnet.ibm.com>
next prev parent reply other threads:[~2015-03-16 11:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-14 8:37 [Qemu-devel] [PATCH] elf-loader: Fix truncation warning from coverity Stefan Weil
2015-03-16 11:50 ` Thomas Huth [this message]
2015-03-19 8:37 ` Michael Tokarev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150316125020.5da0ce16@oc7435384737.ibm.com \
--to=thuth@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=sw@weilnetz.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).