On Fri 27 Apr 2018 05:43:33 PM CEST, Eric Blake wrote: >>> -static int bdrv_rw_co(BdrvChild *child, int64_t sector_num, uint8_t *buf, >>> - int nb_sectors, bool is_write, BdrvRequestFlags >>> flags) >>> -{ >>> - QEMUIOVector qiov; >>> - struct iovec iov = { >>> - .iov_base = (void *)buf, >>> - .iov_len = nb_sectors * BDRV_SECTOR_SIZE, >>> - }; >>> - >>> - if (nb_sectors < 0 || nb_sectors > BDRV_REQUEST_MAX_SECTORS) { >>> - return -EINVAL; >>> - } >> >> Do we have a check for BDRV_REQUEST_MAX_BYTES in the byte-based API? > > No, but we don't need one. First, note that bs->bl.max_transfer is > currently uint32_t, so right now, no driver can set it any larger than > 4G
But note that the old limit was based on a signed integer. BDRV_REQUEST_MAX_SECTORS is 2147483136 bytes (a bit less than 2GB). For 32-bit integers, (INT_MAX - 1) & ~511 = 2147483136 Berto