[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 05/21] nbd/server: Hoist length check to qmp_
From: |
Vladimir Sementsov-Ogievskiy |
Subject: |
Re: [Qemu-devel] [PATCH v4 05/21] nbd/server: Hoist length check to qmp_nbd_server_add |
Date: |
Fri, 18 Jan 2019 09:48:06 +0000 |
17.01.2019 22:36, Eric Blake wrote:
> We only had two callers to nbd_export_new; qemu-nbd.c always
> passed a valid offset/length pair (because it already checked
> the file length, to ensure that offset was in bounds), while
> blockdev-nbd.c always passed 0/-1. Then nbd_export_new reduces
> the size to a multiple of BDRV_SECTOR_SIZE (can only happen
> when offset is not sector-aligned, since bdrv_getlength()
> currently rounds up), which can result in offset being greater
> than the enforced length, but that's not fatal (the server
> rejects client requests that exceed the advertised length).
>
> However, I'm finding it easier to work with the code if we are
> consistent on having both callers pass in a valid length, and
> just assert that things are sane in nbd_export_new, meaning
> that no negative values were passed, and that offset+size does
> not exceed 63 bits (as that really is a fundamental limit to
> later operations, whether we use off_t or uint64_t).
>
> Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Vladimir Sementsov-Ogievskiy <address@hidden>
--
Best regards,
Vladimir
- [Qemu-devel] [PATCH v4 00/21] nbd: add qemu-nbd --list, Eric Blake, 2019/01/17
- [Qemu-devel] [PATCH v4 02/21] maint: Allow for EXAMPLES in texi2pod, Eric Blake, 2019/01/17
- [Qemu-devel] [PATCH v4 01/21] iotests: Make 233 output more reliable, Eric Blake, 2019/01/17
- [Qemu-devel] [PATCH v4 03/21] qemu-nbd: Enhance man page, Eric Blake, 2019/01/17
- [Qemu-devel] [PATCH v4 04/21] qemu-nbd: Sanity check partition bounds, Eric Blake, 2019/01/17
- [Qemu-devel] [PATCH v4 05/21] nbd/server: Hoist length check to qmp_nbd_server_add, Eric Blake, 2019/01/17
- Re: [Qemu-devel] [PATCH v4 05/21] nbd/server: Hoist length check to qmp_nbd_server_add,
Vladimir Sementsov-Ogievskiy <=
- [Qemu-devel] [PATCH v4 06/21] nbd/server: Favor [u]int64_t over off_t, Eric Blake, 2019/01/17
- [Qemu-devel] [PATCH v4 07/21] qemu-nbd: Avoid strtol open-coding, Eric Blake, 2019/01/17
- [Qemu-devel] [PATCH v4 08/21] nbd/client: Refactor nbd_receive_list(), Eric Blake, 2019/01/17
- [Qemu-devel] [PATCH v4 09/21] nbd/client: Move export name into NBDExportInfo, Eric Blake, 2019/01/17
- [Qemu-devel] [PATCH v4 15/21] nbd/client: Pull out oldstyle size determination, Eric Blake, 2019/01/17
- [Qemu-devel] [PATCH v4 11/21] nbd/client: Split out nbd_send_meta_query(), Eric Blake, 2019/01/17
- [Qemu-devel] [PATCH v4 20/21] nbd/client: Work around 3.0 bug for listing meta contexts, Eric Blake, 2019/01/17
- [Qemu-devel] [PATCH v4 10/21] nbd/client: Change signature of nbd_negotiate_simple_meta_context(), Eric Blake, 2019/01/17