diff options
author | Peter Maydell | 2019-11-05 21:17:11 +0100 |
---|---|---|
committer | Peter Maydell | 2019-11-05 21:17:11 +0100 |
commit | 412fbef3d076c43e56451bacb28c4544858c66a3 (patch) | |
tree | ed52e758c6058e480da5bb1fc741b1b7478f2fdf /hw | |
parent | Merge remote-tracking branch 'remotes/palmer/tags/palmer-for-master-4.2-sf1' ... (diff) | |
parent | tests/fw_cfg: Test 'reboot-timeout=-1' special value (diff) | |
download | qemu-412fbef3d076c43e56451bacb28c4544858c66a3.tar.gz qemu-412fbef3d076c43e56451bacb28c4544858c66a3.tar.xz qemu-412fbef3d076c43e56451bacb28c4544858c66a3.zip |
Merge remote-tracking branch 'remotes/philmd-gitlab/tags/fw_cfg-next-pull-request' into staging
Fix the fw_cfg reboot-timeout=-1 special value, add a test for it.
# gpg: Signature made Sun 03 Nov 2019 22:21:02 GMT
# gpg: using RSA key 89C1E78F601EE86C867495CBA2A3FD6EDEADC0DE
# gpg: Good signature from "Philippe Mathieu-Daudé (Phil) <philmd@redhat.com>" [marginal]
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg: It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 89C1 E78F 601E E86C 8674 95CB A2A3 FD6E DEAD C0DE
* remotes/philmd-gitlab/tags/fw_cfg-next-pull-request:
tests/fw_cfg: Test 'reboot-timeout=-1' special value
fw_cfg: Allow reboot-timeout=-1 again
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/nvram/fw_cfg.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c index 44a3c19326..5d879c471e 100644 --- a/hw/nvram/fw_cfg.c +++ b/hw/nvram/fw_cfg.c @@ -237,7 +237,7 @@ static void fw_cfg_bootsplash(FWCfgState *s) static void fw_cfg_reboot(FWCfgState *s) { const char *reboot_timeout = NULL; - int64_t rt_val = -1; + uint64_t rt_val = -1; uint32_t rt_le32; /* get user configuration */ @@ -247,10 +247,11 @@ static void fw_cfg_reboot(FWCfgState *s) if (reboot_timeout) { rt_val = qemu_opt_get_number(opts, "reboot-timeout", -1); + /* validate the input */ - if (rt_val < 0 || rt_val > 0xffff) { + if (rt_val > 0xffff && rt_val != (uint64_t)-1) { error_report("reboot timeout is invalid," - "it should be a value between 0 and 65535"); + "it should be a value between -1 and 65535"); exit(1); } } |