On 2018-02-23 20:25, Kevin Wolf wrote: > The "redundancy" option for Sheepdog image creation is currently a > string that can encode one or two integers depending on its format, > which at the same time implicitly selects a mode. > > This patch turns it into a QAPI union and converts the string into such > a QAPI object before interpreting the values. > > Signed-off-by: Kevin Wolf <kw...@redhat.com> > Reviewed-by: Max Reitz <mre...@redhat.com> > --- > qapi/block-core.json | 45 +++++++++++++++++++++++++ > block/sheepdog.c | 94 > +++++++++++++++++++++++++++++++++++++--------------- > 2 files changed, 112 insertions(+), 27 deletions(-)
[...] > @@ -1907,35 +1950,32 @@ static int parse_redundancy(BDRVSheepdogState *s, > const char *opt) > return -EINVAL; > } > > - copy = strtol(n1, NULL, 10); > - /* FIXME fix error checking by switching to qemu_strtol() */ > - if (copy > SD_MAX_COPIES || copy < 1) { > - return -EINVAL; > - } > - if (!n2) { > - inode->copy_policy = 0; > - inode->nr_copies = copy; > - return 0; > + ret = qemu_strtol(n1, NULL, 10, ©); (By the way: This was what I was thanking you for in v2 -- I just now realized I was clever enough not to point to it in my reply...) > + if (ret < 0) { > + return ret; > }
signature.asc
Description: OpenPGP digital signature