From patchwork Wed Apr 3 14:01:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Franciosi X-Patchwork-Id: 233489 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D7E4C2C0099 for ; Thu, 4 Apr 2013 01:03:18 +1100 (EST) Received: from localhost ([::1]:41157 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNOHV-0003DS-3P for incoming@patchwork.ozlabs.org; Wed, 03 Apr 2013 10:03:17 -0400 Received: from eggs.gnu.org ([208.118.235.92]:44952) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNOGU-000274-QU for qemu-devel@nongnu.org; Wed, 03 Apr 2013 10:02:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UNOGM-0005gw-3Q for qemu-devel@nongnu.org; Wed, 03 Apr 2013 10:02:14 -0400 Received: from smtp.citrix.com ([66.165.176.89]:32837) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UNOGL-0005gn-Vw for qemu-devel@nongnu.org; Wed, 03 Apr 2013 10:02:06 -0400 X-IronPort-AV: E=Sophos;i="4.87,401,1363132800"; d="scan'208";a="17223927" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP/TLS/AES128-SHA; 03 Apr 2013 14:02:05 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.79) with Microsoft SMTP Server id 14.2.342.3; Wed, 3 Apr 2013 10:02:05 -0400 Received: from st06.uk.xensource.com ([10.80.228.6]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1UNOGK-0000cs-MW; Wed, 03 Apr 2013 15:02:04 +0100 From: Felipe Franciosi To: Date: Wed, 3 Apr 2013 15:01:12 +0100 Message-ID: <1364997672-29579-3-git-send-email-felipe.franciosi@citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1364997672-29579-1-git-send-email-felipe.franciosi@citrix.com> References: <1364997672-29579-1-git-send-email-felipe.franciosi@citrix.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.165.176.89 Cc: Felipe Franciosi , xen-devel@lists.xen.org, Felipe Franciosi , Stefano Stabellini Subject: [Qemu-devel] [PATCH 2/2] Allow xen guests to plug disks of 1 TiB or more 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 The current xen backend driver implementation uses int64_t variables to store the size of the corresponding backend disk/file. It also uses an int64_t variable to store the block size of that image. When writing the number of sectors (file_size/block_size) to xenstore, however, it passes these values as 32 bit signed integers. This will cause an overflow for any disk of 1 TiB or more. This patch changes the xen backend driver to use a 64 bit integer write xenstore function. Signed-off-by: Felipe Franciosi Acked-by: Stefano Stabellini --- hw/xen_disk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/xen_disk.c b/hw/xen_disk.c index 83329e2..6255075 100644 --- a/hw/xen_disk.c +++ b/hw/xen_disk.c @@ -797,8 +797,8 @@ static int blk_init(struct XenDevice *xendev) xenstore_write_be_int(&blkdev->xendev, "feature-persistent", 1); xenstore_write_be_int(&blkdev->xendev, "info", info); xenstore_write_be_int(&blkdev->xendev, "sector-size", blkdev->file_blk); - xenstore_write_be_int(&blkdev->xendev, "sectors", - blkdev->file_size / blkdev->file_blk); + xenstore_write_be_int64(&blkdev->xendev, "sectors", + blkdev->file_size / blkdev->file_blk); return 0; out_error: