From: Max Reitz <mreitz@redhat.com>
To: Eric Blake <eblake@redhat.com>,
Changlong Xie <xiecl.fnst@cn.fujitsu.com>,
qemu devel <qemu-devel@nongnu.org>,
Alberto Garcia <berto@igalia.com>, Kevin Wolf <kwolf@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Cc: qemu block <qemu-block@nongnu.org>,
Jiang Yunhong <yunhong.jiang@intel.com>,
Dong Eddie <eddie.dong@intel.com>,
Markus Armbruster <armbru@redhat.com>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
Gonglei <arei.gonglei@huawei.com>,
zhanghailiang <zhang.zhanghailiang@huawei.com>
Subject: Re: [Qemu-devel] [PATCH v10 2/3] quorum: implement bdrv_add_child() and bdrv_del_child()
Date: Mon, 7 Mar 2016 17:02:56 +0100 [thread overview]
Message-ID: <56DDA630.4000409@redhat.com> (raw)
In-Reply-To: <56DDA5FF.2050900@redhat.com>
[-- Attachment #1.1: Type: text/plain, Size: 647 bytes --]
On 07.03.2016 17:02, Eric Blake wrote:
> On 03/05/2016 11:13 AM, Max Reitz wrote:
>
>>> + index = atoi(child->name + 9);
>>
>> Optional: Assert absence of an error:
>>
>
> Indeed, atoi() is worthless, because it cannot do error detection.
>
>> unsigned long index;
>> char *endptr;
>>
>> index = strtoul(child->name + 9, &endptr, 10);
>> assert(index >= 0 && !*endptr);
>
> Still incorrect; you aren't handling errno properly for detecting all
> errors. Even better is to use qemu_strtoul(), which already handles
> proper error detection.
Yeah, I keep forgetting that it returns ULONG_MAX on range error...
Max
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2016-03-07 16:03 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-16 9:37 [Qemu-devel] [PATCH v10 0/3] qapi: child add/delete support Changlong Xie
2016-02-16 9:37 ` [Qemu-devel] [PATCH v10 1/3] Add new block driver interface to add/delete a BDS's child Changlong Xie
2016-03-05 17:27 ` Max Reitz
2016-03-07 4:16 ` Changlong Xie
2016-03-07 15:23 ` Max Reitz
2016-02-16 9:37 ` [Qemu-devel] [PATCH v10 2/3] quorum: implement bdrv_add_child() and bdrv_del_child() Changlong Xie
2016-03-05 18:13 ` Max Reitz
2016-03-07 9:13 ` Changlong Xie
2016-03-07 16:02 ` Eric Blake
2016-03-07 16:02 ` Max Reitz [this message]
2016-03-08 2:57 ` Changlong Xie
2016-03-09 15:27 ` Max Reitz
2016-03-08 1:42 ` Changlong Xie
2016-02-16 9:37 ` [Qemu-devel] [PATCH v10 3/3] qmp: add monitor command to add/remove a child Changlong Xie
2016-03-05 18:33 ` Max Reitz
2016-03-07 9:15 ` Changlong Xie
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=56DDA630.4000409@redhat.com \
--to=mreitz@redhat.com \
--cc=arei.gonglei@huawei.com \
--cc=armbru@redhat.com \
--cc=berto@igalia.com \
--cc=dgilbert@redhat.com \
--cc=eblake@redhat.com \
--cc=eddie.dong@intel.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=xiecl.fnst@cn.fujitsu.com \
--cc=yunhong.jiang@intel.com \
--cc=zhang.zhanghailiang@huawei.com \
/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).