block/export: improve vu_blk_sect_range_ok()
commit1b0b2e6d06c26185ecc820e868e025c894f979f7
authorStefan Hajnoczi <stefanha@redhat.com>
Wed, 31 Mar 2021 14:27:27 +0000 (31 15:27 +0100)
committerKevin Wolf <kwolf@redhat.com>
Tue, 18 May 2021 09:08:13 +0000 (18 11:08 +0200)
treeb301894b1230a5217f05dac54b2775882ffd8fdb
parente3fc91aaaacbdc2a88bbb4109c8a1cded628e36f
block/export: improve vu_blk_sect_range_ok()

The checks in vu_blk_sect_range_ok() assume VIRTIO_BLK_SECTOR_SIZE is
equal to BDRV_SECTOR_SIZE. This is true, but let's add a
QEMU_BUILD_BUG_ON() to make it explicit.

We might as well check that the request buffer size is a multiple of
VIRTIO_BLK_SECTOR_SIZE while we're at it.

Suggested-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20210331142727.391465-1-stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/export/vhost-user-blk-server.c