From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57298) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGZ8v-00035H-K5 for qemu-devel@nongnu.org; Tue, 05 Jan 2016 16:27:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aGZ8s-0008OA-EH for qemu-devel@nongnu.org; Tue, 05 Jan 2016 16:27:49 -0500 References: <1451928613-29476-1-git-send-email-mark.cave-ayland@ilande.co.uk> From: John Snow Message-ID: <568C354F.3020507@redhat.com> Date: Tue, 5 Jan 2016 16:27:43 -0500 MIME-Version: 1.0 In-Reply-To: <1451928613-29476-1-git-send-email-mark.cave-ayland@ilande.co.uk> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] macio: fix overflow in lba to offset conversion for ATAPI devices List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Mark Cave-Ayland , qemu-devel@nongnu.org, qemu-ppc@nongnu.org, agraf@suse.de 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 > --- > 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