From patchwork Wed Nov 18 16:09:00 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 546094 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 9ED75141468 for ; Thu, 19 Nov 2015 03:09:55 +1100 (AEDT) Received: from localhost ([::1]:36714 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zz5Iv-0004RE-J5 for incoming@patchwork.ozlabs.org; Wed, 18 Nov 2015 11:09:53 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36979) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zz5IH-0003JR-0f for qemu-devel@nongnu.org; Wed, 18 Nov 2015 11:09:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zz5IF-0007PF-No for qemu-devel@nongnu.org; Wed, 18 Nov 2015 11:09:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:52001) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zz5IC-0007Np-PF; Wed, 18 Nov 2015 11:09:08 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 36138C1C4BB3; Wed, 18 Nov 2015 16:09:08 +0000 (UTC) Received: from noname.str.redhat.com (dhcp-192-197.str.redhat.com [10.33.192.197]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tAIG94Bs006401; Wed, 18 Nov 2015 11:09:06 -0500 From: Kevin Wolf To: qemu-block@nongnu.org Date: Wed, 18 Nov 2015 17:09:00 +0100 Message-Id: <1447862943-16071-2-git-send-email-kwolf@redhat.com> In-Reply-To: <1447862943-16071-1-git-send-email-kwolf@redhat.com> References: <1447862943-16071-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PULL 1/4] nand: fix address overflow X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Rabin Vincent The shifts of the address mask and value shift beyond 32 bits when there are 5 address cycles. Cc: qemu-stable@nongnu.org Signed-off-by: Rabin Vincent Reviewed-by: Paolo Bonzini Reviewed-by: Peter Crosthwaite Signed-off-by: Kevin Wolf --- 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 ++;