[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 07/22] qemu-nbd: Avoid strtol open-coding
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
Re: [Qemu-devel] [PATCH v2 07/22] qemu-nbd: Avoid strtol open-coding |
Date: |
Tue, 18 Dec 2018 15:11:18 +0000 |
15.12.2018 16:53, Eric Blake wrote:
> Our copy-and-pasted open-coding of strtol handling forgot to
> handle overflow conditions. Use qemu_strto*() instead.
>
> In the case of --partition, since we insist on a user-supplied
> partition to be non-zero, we can use 0 rather than -1 for our
> initial value to distinguish when a partition is not being
> served, for slightly more optimal code.
>
> The error messages for out-of-bounds values are less specific,
> but should not be a terrible loss in quality.
>
> Signed-off-by: Eric Blake <address@hidden>
>
> ---
> v2: Retitle, catch more uses of strtol
> [Hmm - this depends on int64_t and off_t being compatible; if they
> aren't that way on all platforms, I'll need a temporary variable]
hmm, as I understand, even if this compatibility exists, it's not a part
of standard and nothing about off_t size in POSIX..
Moreover: what is the reason for using off_t in NBD code? We don't have it
in NBD protocol, we don't have it in generic block layer interface. Isn't it
always casted to int64_t or like this?
--
Best regards,
Vladimir
- Re: [Qemu-devel] [PATCH v2 03/22] maint: Allow for EXAMPLES in texi2pod, (continued)
- [Qemu-devel] [PATCH v2 05/22] nbd/client: More consistent error messages, Eric Blake, 2018/12/15
- [Qemu-devel] [PATCH v2 06/22] qemu-nbd: Fail earlier for -c/-d on non-linux, Eric Blake, 2018/12/15
- [Qemu-devel] [PATCH v2 04/22] qemu-nbd: Enhance man page, Eric Blake, 2018/12/15
- [Qemu-devel] [PATCH v2 07/22] qemu-nbd: Avoid strtol open-coding, Eric Blake, 2018/12/15
- [Qemu-devel] [PATCH v2 11/22] nbd/client: Change signature of nbd_negotiate_simple_meta_context(), Eric Blake, 2018/12/15
- [Qemu-devel] [PATCH v2 08/22] nbd/client: Drop pointless buf variable, Eric Blake, 2018/12/15
- [Qemu-devel] [PATCH v2 10/22] nbd/client: Move export name into NBDExportInfo, Eric Blake, 2018/12/15
- [Qemu-devel] [PATCH v2 12/22] nbd/client: Improve error handling in nbd_negotiate_simple_meta_context(), Eric Blake, 2018/12/15