[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/2] hw: fw_cfg: ensure reboot_time is nonegativ
From: |
Gerd Hoffmann |
Subject: |
Re: [Qemu-devel] [PATCH 1/2] hw: fw_cfg: ensure reboot_time is nonegative |
Date: |
Mon, 5 Nov 2018 09:26:22 +0100 |
User-agent: |
NeoMutt/20180716 |
> - /* validate the input */
> - if (reboot_timeout > 0xffff) {
> - error_report("reboot timeout is larger than 65535, force it to
> 65535.");
> - reboot_timeout = 0xffff;
> +
> + if (reboot_timeout >= 0) {
> + /* validate the input */
> + if (reboot_timeout > 0xffff) {
> + error_report("reboot timeout is larger than 65535,"
> + "force it to 65535.");
> + reboot_timeout = 0xffff;
> + }
> + fw_cfg_add_file(s, "etc/boot-fail-wait",
> + g_memdup(&reboot_timeout, 4), 4);
> }
Hmm, values > 0xffff are reported and values < 0 are silently ignored.
I think we should be consistent here.
I'd suggest report and exit in both cases,
i.e. use error_setg(..., &error_fatal);
cheers,
Gerd