]> git.ipfire.org Git - thirdparty/qemu.git/commit
hw/sd/sdcard: Fix size check for backing block image
authorJan Kiszka <jan.kiszka@siemens.com>
Sun, 24 Aug 2025 07:18:33 +0000 (09:18 +0200)
committerPhilippe Mathieu-Daudé <philmd@linaro.org>
Wed, 5 Nov 2025 08:25:34 +0000 (09:25 +0100)
commita362b19a39e458256cc7e3acd0dc7825b0389b48
tree93ce32d5fd87e8784748936bcfa055455e80f334
parente9c692eabbbb7f395347605a6ef33a32d398ea25
hw/sd/sdcard: Fix size check for backing block image

Alignment rules apply the the individual partitions (user, boot, later
on also RPMB) and depend both on the size of the image and the type of
the device. Up to and including 2GB, the power-of-2 rule applies to the
user data area. For larger images, multiples of 512 sectors must be used
for eMMC and multiples of 512K for SD-cards. Fix the check accordingly
and also detect if the image is too small to even hold the boot
partitions.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Warner Losh <imp@bsdimp.com>
Message-ID: <591f6d8a9dc86428723cb6876df6e717cc41a70e.1762261430.git.jan.kiszka@siemens.com>
Tested-by: Cédric Le Goater <clg@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
hw/sd/sd.c