[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 1/8] hw/sd: sd: Fix address check in sd_erase()
From: |
Bin Meng |
Subject: |
[PATCH v2 1/8] hw/sd: sd: Fix address check in sd_erase() |
Date: |
Tue, 16 Feb 2021 23:02:18 +0800 |
From: Bin Meng <bin.meng@windriver.com>
For high capacity memory cards, the erase start address and end
address are multiplied by 512, but the address check is still
based on the original block number in sd->erase_{start, end}.
Fixes: 1bd6fd8ed593 ("hw/sd/sdcard: Do not attempt to erase out of range
addresses")
Signed-off-by: Bin Meng <bin.meng@windriver.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
(no changes since v1)
hw/sd/sd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index c99c0e93bb..a6a0b3dcc6 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -760,7 +760,7 @@ static void sd_erase(SDState *sd)
erase_end *= 512;
}
- if (sd->erase_start > sd->size || sd->erase_end > sd->size) {
+ if (erase_start > sd->size || erase_end > sd->size) {
sd->card_status |= OUT_OF_RANGE;
sd->erase_start = INVALID_ADDRESS;
sd->erase_end = INVALID_ADDRESS;
--
2.25.1
- [PATCH v2 0/8] hw/sd: sd: Erase operation and other fixes, Bin Meng, 2021/02/16
- [PATCH v2 1/8] hw/sd: sd: Fix address check in sd_erase(),
Bin Meng <=
- [PATCH v2 2/8] hw/sd: sd: Only SDSC cards support CMD28/29/30, Bin Meng, 2021/02/16
- [PATCH v2 3/8] hw/sd: sd: Fix CMD30 response type, Bin Meng, 2021/02/16
- [PATCH v2 5/8] hw/sd: sd: Skip write protect groups check in sd_erase() for high capacity cards, Bin Meng, 2021/02/16
- [PATCH v2 4/8] hw/sd: sd: Move the sd_block_{read, write} and macros ahead, Bin Meng, 2021/02/16
- [PATCH v2 6/8] hw/sd: sd: Actually perform the erase operation, Bin Meng, 2021/02/16