From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47056) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwAYO-0004it-BF for qemu-devel@nongnu.org; Tue, 10 Nov 2015 10:09:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZwAYN-0003wh-Fe for qemu-devel@nongnu.org; Tue, 10 Nov 2015 10:09:48 -0500 Sender: Paolo Bonzini References: <1447161947-22542-1-git-send-email-rabin.vincent@axis.com> From: Paolo Bonzini Message-ID: <564208B1.7050200@redhat.com> Date: Tue, 10 Nov 2015 16:09:37 +0100 MIME-Version: 1.0 In-Reply-To: <1447161947-22542-1-git-send-email-rabin.vincent@axis.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] nand: fix address overflow List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Rabin Vincent , kwolf@redhat.com Cc: "qemu-trivial@nongnu.org" , qemu-devel@nongnu.org, qemu-block@nongnu.org, Rabin Vincent On 10/11/2015 14:25, Rabin Vincent wrote: > The shifts of the address mask and value shift beyond 32 bits when there > are 5 address cycles. > > Signed-off-by: Rabin Vincent > --- > hw/block/nand.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/hw/block/nand.c b/hw/block/nand.c > index 61d2cec..a68266f 100644 > --- a/hw/block/nand.c > +++ b/hw/block/nand.c > @@ -522,8 +522,8 @@ void nand_setio(DeviceState *dev, uint32_t value) > > if (s->ale) { > unsigned int shift = s->addrlen * 8; > - unsigned int mask = ~(0xff << shift); > - unsigned int v = value << shift; > + uint64_t mask = ~(0xffull << shift); > + uint64_t v = (uint64_t)value << shift; > > s->addr = (s->addr & mask) | v; > s->addrlen ++; > Cc: qemu-trivial@nongnu.org Reviewed-by: Paolo Bonzini