[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-ppc] [Qemu-devel] [PATCH] macio: fix overflow in lba to offset
From: |
John Snow |
Subject: |
Re: [Qemu-ppc] [Qemu-devel] [PATCH] macio: fix overflow in lba to offset conversion for ATAPI devices |
Date: |
Tue, 5 Jan 2016 16:27:43 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 01/04/2016 12:30 PM, Mark Cave-Ayland wrote:
> As the IDEState lba field is an int32_t, make sure we cast to int64_t before
> shifting to calculate the offset. Otherwise we end up with an overflow when
> trying to access sectors beyond 2GB as can occur when using DVD images.
>
> Signed-off-by: Mark Cave-Ayland <address@hidden>
> ---
> hw/ide/macio.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/ide/macio.c b/hw/ide/macio.c
> index 3ee962f..a78b6e0 100644
> --- a/hw/ide/macio.c
> +++ b/hw/ide/macio.c
> @@ -280,7 +280,7 @@ static void pmac_ide_atapi_transfer_cb(void *opaque, int
> ret)
> }
>
> /* Calculate current offset */
> - offset = (int64_t)(s->lba << 11) + s->io_buffer_index;
> + offset = ((int64_t)(s->lba) << 11) + s->io_buffer_index;
>
> pmac_dma_read(s->blk, offset, io->len, pmac_ide_atapi_transfer_cb, io);
> return;
>
Thanks, applied to my IDE tree:
https://github.com/jnsnow/qemu/commits/ide
https://github.com/jnsnow/qemu.git
--js
Re: [Qemu-ppc] [Qemu-devel] [PATCH] macio: fix overflow in lba to offset conversion for ATAPI devices,
John Snow <=