From: "Alex Bennée" <alex.bennee@linaro.org>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: qemu-devel <qemu-devel@nongnu.org>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Bin Meng" <bmeng.cn@gmail.com>,
qemu-block@nongnu.org,
"Ilias Apalodimas" <ilias.apalodimas@linaro.org>
Subject: Re: [PATCH v2 2/8] hw/sd/sdcard: Add validation for boot-partition-size
Date: Mon, 01 Sep 2025 18:19:02 +0100 [thread overview]
Message-ID: <87ms7e146x.fsf@draig.linaro.org> (raw)
In-Reply-To: <1fff448da042bdf8cff7733ce67cadff4c540f1d.1756706188.git.jan.kiszka@siemens.com> (Jan Kiszka's message of "Mon, 1 Sep 2025 07:56:22 +0200")
Jan Kiszka <jan.kiszka@siemens.com> writes:
> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> Make sure we are not silently rounding down or even wrapping around,
> causing inconsistencies with the provided image.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
> hw/sd/sd.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/hw/sd/sd.c b/hw/sd/sd.c
> index 16aee210b4..834392b0a8 100644
> --- a/hw/sd/sd.c
> +++ b/hw/sd/sd.c
> @@ -2818,6 +2818,16 @@ static void sd_realize(DeviceState *dev, Error **errp)
> }
> blk_set_dev_ops(sd->blk, &sd_block_ops, sd);
> }
> + if (sd->boot_part_size % (128 * KiB) ||
> + sd->boot_part_size > 255 * 128 * KiB) {
> + char *size_str = size_to_str(sd->boot_part_size);
> +
This could be:
g_autofree char *size_str = size_to_str(sd->boot_part_size);
> + error_setg(errp, "Invalid boot partition size: %s", size_str);
> + g_free(size_str);
which drops this.
> + error_append_hint(errp,
> + "The boot partition size must be multiples of 128K"
> + "and not larger than 32640K.\n");
> + }
> }
>
> static void emmc_realize(DeviceState *dev, Error **errp)
Otherwise:
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
next prev parent reply other threads:[~2025-09-01 17:19 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-01 5:56 [PATCH v2 0/8] sd: Add RPMB emulation to eMMC model Jan Kiszka
2025-09-01 5:56 ` [PATCH v2 1/8] hw/sd/sdcard: Fix size check for backing block image Jan Kiszka
2025-09-02 15:06 ` Philippe Mathieu-Daudé
2025-09-02 15:34 ` Jan Kiszka
2025-09-02 15:43 ` Philippe Mathieu-Daudé
2025-09-02 15:45 ` Philippe Mathieu-Daudé
2025-09-02 15:47 ` Cédric Le Goater
2025-09-02 15:55 ` Philippe Mathieu-Daudé
2025-09-02 16:00 ` Cédric Le Goater
2025-09-02 16:14 ` Philippe Mathieu-Daudé
2025-09-02 16:19 ` Cédric Le Goater
2025-09-02 16:20 ` Philippe Mathieu-Daudé
2025-09-02 16:24 ` Jan Kiszka
2025-09-02 16:39 ` Jan Kiszka
2025-09-02 16:47 ` Jan Lübbe
2025-09-02 16:52 ` Jan Kiszka
2025-09-02 17:07 ` Warner Losh
2025-09-02 17:18 ` Jan Kiszka
2025-09-02 17:22 ` Warner Losh
2025-09-02 17:30 ` Warner Losh
2025-09-02 17:37 ` Jan Kiszka
2025-09-02 17:48 ` Warner Losh
2025-09-02 17:53 ` Jan Kiszka
2025-09-02 17:55 ` Warner Losh
2025-09-02 17:59 ` Philippe Mathieu-Daudé
2025-09-02 18:07 ` Warner Losh
2025-09-02 17:20 ` Warner Losh
2025-09-02 17:39 ` Jan Kiszka
2025-09-02 17:53 ` Warner Losh
2025-09-02 15:43 ` Cédric Le Goater
2025-09-02 15:47 ` Philippe Mathieu-Daudé
2025-09-02 15:59 ` Cédric Le Goater
2025-09-01 5:56 ` [PATCH v2 2/8] hw/sd/sdcard: Add validation for boot-partition-size Jan Kiszka
2025-09-01 17:19 ` Alex Bennée [this message]
2025-09-01 5:56 ` [PATCH v2 3/8] hw/sd/sdcard: Allow user-instantiated eMMC Jan Kiszka
2025-09-01 5:56 ` [PATCH v2 4/8] hw/sd/sdcard: Refactor sd_bootpart_offset Jan Kiszka
2025-09-01 5:56 ` [PATCH v2 5/8] hw/sd/sdcard: Add basic support for RPMB partition Jan Kiszka
2025-09-01 5:56 ` [PATCH v2 6/8] crypto/hmac: Allow to build hmac over multiple qcrypto_gnutls_hmac_bytes[v] calls Jan Kiszka
2025-09-01 8:55 ` Daniel P. Berrangé
2025-09-01 5:56 ` [PATCH v2 7/8] hw/sd/sdcard: Handle RPMB MAC field Jan Kiszka
2025-09-01 5:56 ` [PATCH v2 8/8] scripts: Add helper script to generate eMMC block device images Jan Kiszka
2025-09-01 17:24 ` Alex Bennée
2025-09-01 20:58 ` [PATCH v2 0/8] sd: Add RPMB emulation to eMMC model Philippe Mathieu-Daudé
2025-09-02 11:42 ` Jan Kiszka
2025-09-02 13:28 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ms7e146x.fsf@draig.linaro.org \
--to=alex.bennee@linaro.org \
--cc=bmeng.cn@gmail.com \
--cc=ilias.apalodimas@linaro.org \
--cc=jan.kiszka@siemens.com \
--cc=philmd@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).