From: Jan Kiszka <[email protected]>

The power-of-2 rule applies to the user data area, not the complete
block image. The latter can be concatenation of boot partition images
and the user data.

Signed-off-by: Jan Kiszka <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-ID: 
<0d95cffa6131a06404f3cd6ef5951720ce01c37e.1756019920.git.jan.kis...@siemens.com>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
---
 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 8b142e4796f..7038a140a28 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -2781,7 +2781,7 @@ static void sd_realize(DeviceState *dev, Error **errp)
             return;
         }
 
-        blk_size = blk_getlength(sd->blk);
+        blk_size = blk_getlength(sd->blk) - sd->boot_part_size * 2;
         if (blk_size > 0 && !is_power_of_2(blk_size)) {
             int64_t blk_size_aligned = pow2ceil(blk_size);
             char *blk_size_str;
-- 
2.51.0


Reply via email to