All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: Fam Zheng <famz@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	armbru@redhat.com, Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] vmdk: Widen before shifting 32 bit header field
Date: Mon, 27 Apr 2015 13:07:46 -0400	[thread overview]
Message-ID: <553E6CE2.6050502@redhat.com> (raw)
In-Reply-To: <1430144581-9803-1-git-send-email-famz@redhat.com>



On 04/27/2015 10:23 AM, Fam Zheng wrote:
> Coverity spotted this.
>
> The field is 32 bits, but if it's possible to overflow in 32 bit
> left shift.
>
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>   block/vmdk.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/block/vmdk.c b/block/vmdk.c
> index 8410a15..d72a6e8 100644
> --- a/block/vmdk.c
> +++ b/block/vmdk.c
> @@ -523,7 +523,7 @@ static int vmdk_open_vmfs_sparse(BlockDriverState *bs,
>       }
>       ret = vmdk_add_extent(bs, file, false,
>                             le32_to_cpu(header.disk_sectors),
> -                          le32_to_cpu(header.l1dir_offset) << 9,
> +                          (int64_t)le32_to_cpu(header.l1dir_offset) << 9,
>                             0,
>                             le32_to_cpu(header.l1dir_size),
>                             4096,
>

Reviewed-by: John Snow <jsnow@redhat.com>

  reply	other threads:[~2015-04-27 17:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-27 14:23 [Qemu-devel] [PATCH] vmdk: Widen before shifting 32 bit header field Fam Zheng
2015-04-27 17:07 ` John Snow [this message]
2015-04-28 12:54   ` Kevin Wolf

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=553E6CE2.6050502@redhat.com \
    --to=jsnow@redhat.com \
    --cc=armbru@redhat.com \
    --cc=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.