From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:53542) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QlUQs-0004uS-B6 for qemu-devel@nongnu.org; Mon, 25 Jul 2011 19:19:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QlUQq-0000qF-2I for qemu-devel@nongnu.org; Mon, 25 Jul 2011 19:19:30 -0400 Received: from smtp-out.google.com ([74.125.121.67]:5173) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QlUQp-0000q1-NT for qemu-devel@nongnu.org; Mon, 25 Jul 2011 19:19:28 -0400 From: Vincent Palatin Date: Mon, 25 Jul 2011 16:19:05 -0700 Message-Id: <1311635951-11047-2-git-send-email-vpalatin@chromium.org> In-Reply-To: <1311635951-11047-1-git-send-email-vpalatin@chromium.org> References: <1311635951-11047-1-git-send-email-vpalatin@chromium.org> Subject: [Qemu-devel] [PATCH 1/7] sd: do not add one sector to the disk size List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Qemu devel Cc: Vincent Palatin This leads to random off-by-one error. When the size of the SD is exactly 1GB, the emulation was returning a wrong SDHC CSD descriptor. Signed-off-by: Vincent Palatin --- hw/sd.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/hw/sd.c b/hw/sd.c index cedfb20..f48d589 100644 --- a/hw/sd.c +++ b/hw/sd.c @@ -393,9 +393,7 @@ static void sd_reset(SDState *sd, BlockDriverState *bdrv) } else { sect = 0; } - sect <<= 9; - - size = sect + 1; + size = sect << 9; sect = (size >> (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT)) + 1; -- 1.7.3.1