From: Eric Blake <eblake@redhat.com>
To: Laszlo Ersek <lersek@redhat.com>, Li Qiang <liq3ea@gmail.com>,
peter.maydell@linaro.org, pbonzini@redhat.com
Cc: qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] fw_cfg_reboot: ensure reboot_time is nonegative
Date: Wed, 31 Oct 2018 10:54:56 -0500 [thread overview]
Message-ID: <b8e3151d-b453-67a7-89ef-cdf2ff257a6b@redhat.com> (raw)
In-Reply-To: <4d64d42a-8727-81aa-6015-a9db92abca76@redhat.com>
On 10/24/18 6:35 AM, Laszlo Ersek wrote:
> On 10/24/18 09:11, Li Qiang wrote:
>> This can avoid setting a negative value to
>> etc/boot-fail-wait.
>>
>> Signed-off-by: Li Qiang <liq3ea@gmail.com>
>> ---
>> hw/nvram/fw_cfg.c | 15 ++++++++++-----
>> 1 file changed, 10 insertions(+), 5 deletions(-)
>>
>> diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
>> index f4a52d8..276dcb1 100644
>> --- a/hw/nvram/fw_cfg.c
>> +++ b/hw/nvram/fw_cfg.c
>> @@ -199,12 +199,17 @@ static void fw_cfg_reboot(FWCfgState *s)
>> reboot_timeout = strtol(p, &p, 10);
Looks like Markus handled the question about replacing strtol(), so I'll
just point out one additional nit:
>> }
>> }
>> - /* validate the input */
>> - if (reboot_timeout > 0xffff) {
>> - error_report("reboot timeout is larger than 65535, force it to 65535.");
Pre-existing, but now's as good a time as any to improve it:
>> - 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.");
error_report() callers generally do not end with trailing '.'
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
next prev parent reply other threads:[~2018-10-31 15:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-24 7:11 [Qemu-devel] [PATCH] fw_cfg_reboot: ensure reboot_time is nonegative Li Qiang
2018-10-24 11:35 ` Laszlo Ersek
2018-10-24 22:56 ` Philippe Mathieu-Daudé
2018-10-25 1:45 ` Li Qiang
2018-10-29 23:50 ` Philippe Mathieu-Daudé
2018-10-30 1:29 ` Li Qiang
2018-10-31 15:46 ` Markus Armbruster
2018-10-31 15:54 ` Eric Blake [this message]
2018-11-01 6:13 ` Li Qiang
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=b8e3151d-b453-67a7-89ef-cdf2ff257a6b@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.com \
--cc=lersek@redhat.com \
--cc=liq3ea@gmail.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.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).