diff options
author | Eric Blake <eblake@redhat.com> | 2019-01-17 13:36:42 -0600 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2019-01-21 15:49:51 -0600 |
commit | 7596bbb390838359e4789996f349bda0cad56b0e (patch) | |
tree | c42691a88bb5a3556682937e92fa53326e68bedb /MAINTAINERS | |
parent | 4485936b6de20afa38138e9d1e8ffed88cf0be73 (diff) | |
download | qemu-7596bbb390838359e4789996f349bda0cad56b0e.zip qemu-7596bbb390838359e4789996f349bda0cad56b0e.tar.gz qemu-7596bbb390838359e4789996f349bda0cad56b0e.tar.bz2 |
nbd/server: Hoist length check to qmp_nbd_server_add
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) (someday, it would be nice to have
byte-accurate lengths - but not today).
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 <eblake@redhat.com>
Message-Id: <20190117193658.16413-6-eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Diffstat (limited to 'MAINTAINERS')
0 files changed, 0 insertions, 0 deletions