Am 06.02.2015 um 13:16 hat Peter Lieven geschrieben:
> Am 06.02.2015 um 12:53 schrieb Kevin Wolf:
> > Am 06.02.2015 um 12:24 hat Denis V. Lunev geschrieben:
> >> 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 <d...@openvz.org>
> >> CC: Peter Lieven <p...@kamp.de>
> >> CC: Kevin Wolf <kw...@redhat.com>
> > Thanks, I have applied both Peter's and your patch. Can you guys please
> > check whether the current state of my block branch is correct or whether
> > I forgot to include or remove some patch?
> 
> Looks good from my point of view.
> 
> Just to be sure has it to be
> 
> if (size > BDRV_REQUEST_MAX_SECTORS << BDRV_SECTOR_BITS)
> 
> or
> 
> if (size > (BDRV_REQUEST_MAX_SECTORS << BDRV_SECTOR_BITS))
> 
> ?
> 
> If the latter is right, can you please fix that line in my patch. I am afk 
> now.

Both versions are correct.

Kevin

Reply via email to