[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/38] qapi: treat all negative return of strtosz_suf
From: |
Luiz Capitulino |
Subject: |
[Qemu-devel] [PULL 05/38] qapi: treat all negative return of strtosz_suffix() as error |
Date: |
Thu, 8 May 2014 14:52:29 -0400 |
From: Amos Kong <address@hidden>
strtosz_suffix() might return negative error, this patch fixes
the error handling.
This patch also changes to handle error in the if statement
rather than handle success specially, this will make this use
of strtosz_suffix consistent with all other uses.
Signed-off-by: Amos Kong <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>
---
qapi/opts-visitor.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/qapi/opts-visitor.c b/qapi/opts-visitor.c
index 5d830a2..87c1c78 100644
--- a/qapi/opts-visitor.c
+++ b/qapi/opts-visitor.c
@@ -472,13 +472,14 @@ opts_type_size(Visitor *v, uint64_t *obj, const char
*name, Error **errp)
val = strtosz_suffix(opt->str ? opt->str : "", &endptr,
STRTOSZ_DEFSUFFIX_B);
- if (val != -1 && *endptr == '\0') {
- *obj = val;
- processed(ov, name);
+ if (val < 0 || *endptr) {
+ error_set(errp, QERR_INVALID_PARAMETER_VALUE, opt->name,
+ "a size value representible as a non-negative int64");
return;
}
- error_set(errp, QERR_INVALID_PARAMETER_VALUE, opt->name,
- "a size value representible as a non-negative int64");
+
+ *obj = val;
+ processed(ov, name);
}
--
1.9.0
- [Qemu-devel] [PULL 00/38] QMP queue, Luiz Capitulino, 2014/05/08
- [Qemu-devel] [PULL 03/38] qapi: Use an explicit input file, Luiz Capitulino, 2014/05/08
- [Qemu-devel] [PULL 04/38] qapi: Add a primitive to include other files from a QAPI schema file, Luiz Capitulino, 2014/05/08
- [Qemu-devel] [PULL 02/38] qapi: [trivial] Do not catch unknown exceptions in "test-qapi.py", Luiz Capitulino, 2014/05/08
- [Qemu-devel] [PULL 01/38] qapi: [trivial] Break long command lines, Luiz Capitulino, 2014/05/08
- [Qemu-devel] [PULL 06/38] cutils: tighten qemu_parse_fd(), Luiz Capitulino, 2014/05/08
- [Qemu-devel] [PULL 07/38] monitor: add Error-propagating monitor_handle_fd_param2(), Luiz Capitulino, 2014/05/08
- [Qemu-devel] [PULL 08/38] pci-assign: accept Error from monitor_handle_fd_param2(), Luiz Capitulino, 2014/05/08
- [Qemu-devel] [PULL 05/38] qapi: treat all negative return of strtosz_suffix() as error,
Luiz Capitulino <=
- [Qemu-devel] [PULL 11/38] pci-assign: propagate Error from check_irqchip_in_kernel(), Luiz Capitulino, 2014/05/08
- [Qemu-devel] [PULL 10/38] pci-assign: propagate errors from get_real_id(), Luiz Capitulino, 2014/05/08
- [Qemu-devel] [PULL 14/38] pci-assign: assignment should fail if we can't read config space, Luiz Capitulino, 2014/05/08
- [Qemu-devel] [PULL 12/38] pci: add Error-propagating pci_add_capability2(), Luiz Capitulino, 2014/05/08
- [Qemu-devel] [PULL 13/38] pci-assign: accept Error from pci_add_capability2(), Luiz Capitulino, 2014/05/08
- [Qemu-devel] [PULL 15/38] pci-assign: propagate errors from get_real_device(), Luiz Capitulino, 2014/05/08
- [Qemu-devel] [PULL 16/38] pci-assign: propagate errors from assigned_device_pci_cap_init(), Luiz Capitulino, 2014/05/08
- [Qemu-devel] [PULL 09/38] pci-assign: make assign_failed_examine() just format the cause, Luiz Capitulino, 2014/05/08
- [Qemu-devel] [PULL 18/38] pci-assign: propagate errors from assigned_dev_register_regions(), Luiz Capitulino, 2014/05/08
- [Qemu-devel] [PULL 17/38] pci-assign: propagate errors from assigned_dev_register_msix_mmio(), Luiz Capitulino, 2014/05/08