[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/7] sd: do not add one sector to the disk size
From: |
Vincent Palatin |
Subject: |
[Qemu-devel] [PATCH 1/7] sd: do not add one sector to the disk size |
Date: |
Mon, 25 Jul 2011 16:19:05 -0700 |
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 <address@hidden>
---
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
- [Qemu-devel] sd: add SDHCI and eMMC support, Vincent Palatin, 2011/07/25
- [Qemu-devel] [PATCH 3/7] block: add eMMC block device type, Vincent Palatin, 2011/07/25
- [Qemu-devel] [PATCH 4/7] sd: add eMMC support, Vincent Palatin, 2011/07/25
- [Qemu-devel] [PATCH 7/7] sd: compile SDHCI on PCI platforms, Vincent Palatin, 2011/07/25
- [Qemu-devel] [PATCH 2/7] sd: fix card size checking on R/W accesses, Vincent Palatin, 2011/07/25
- [Qemu-devel] [PATCH 5/7] sd: add PCI ids for SDHCI controller, Vincent Palatin, 2011/07/25
- [Qemu-devel] [PATCH 1/7] sd: do not add one sector to the disk size,
Vincent Palatin <=
- [Qemu-devel] [PATCH 6/7] sd: add SD Host Controller (SDHCI) emulation, Vincent Palatin, 2011/07/25