]> Git Repo - qemu.git/commit
nbd: fix max_discard/max_transfer_length
authorDenis V. Lunev <[email protected]>
Fri, 6 Feb 2015 11:24:43 +0000 (14:24 +0300)
committerKevin Wolf <[email protected]>
Fri, 6 Feb 2015 16:24:22 +0000 (17:24 +0100)
commitfa21e6faa6f1d7de49fd030ebdb0722b59cf9a41
treedfe2e036e62eb9896a82668268a2f1e9ba1c23cb
parent75af1f34cd5b07c3c7fcf86dfc99a42de48a600d
nbd: fix max_discard/max_transfer_length

nbd_co_discard calls nbd_client_session_co_discard which uses uint32_t
as the length in bytes of the data to discard due to the following
definition:

struct nbd_request {
    uint32_t magic;
    uint32_t type;
    uint64_t handle;
    uint64_t from;
    uint32_t len; <-- the length of data to be discarded, in bytes
} QEMU_PACKED;

Thus we should limit bl_max_discard to UINT32_MAX >> BDRV_SECTOR_BITS to
avoid overflow.

NBD read/write code uses the same structure for transfers. Fix
max_transfer_length accordingly.

Signed-off-by: Denis V. Lunev <[email protected]>
CC: Peter Lieven <[email protected]>
CC: Kevin Wolf <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
block/nbd.c
This page took 0.025301 seconds and 4 git commands to generate.