mirror of https://gitee.com/openkylin/qemu.git
sd: do not add one sector to the disk size
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 <vpalatin@chromium.org> Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
This commit is contained in:
parent
4b5dfd8246
commit
5e37141bbb
4
hw/sd.c
4
hw/sd.c
|
@ -393,9 +393,7 @@ static void sd_reset(SDState *sd, BlockDriverState *bdrv)
|
||||||
} else {
|
} else {
|
||||||
sect = 0;
|
sect = 0;
|
||||||
}
|
}
|
||||||
sect <<= 9;
|
size = sect << 9;
|
||||||
|
|
||||||
size = sect + 1;
|
|
||||||
|
|
||||||
sect = (size >> (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT)) + 1;
|
sect = (size >> (HWBLOCK_SHIFT + SECTOR_SHIFT + WPGROUP_SHIFT)) + 1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue