All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit f3a9cfdd authored by Fam Zheng's avatar Fam Zheng Committed by Stefan Hajnoczi

block: Fix max nb_sectors in bdrv_make_zero

In bdrv_rw_co we report -EINVAL for nb_sectors > INT_MAX /
BDRV_SECTOR_SIZE, so a caller shouldn't exceed it.
Signed-off-by: default avatarFam Zheng <>
Reviewed-by: default avatarMarkus Armbruster <>
Signed-off-by: default avatarStefan Hajnoczi <>
parent 107f0d46
......@@ -2790,8 +2790,8 @@ int bdrv_make_zero(BlockDriverState *bs, BdrvRequestFlags flags)
if (nb_sectors <= 0) {
return 0;
if (nb_sectors > INT_MAX) {
nb_sectors = INT_MAX;
if (nb_sectors > INT_MAX / BDRV_SECTOR_SIZE) {
nb_sectors = INT_MAX / BDRV_SECTOR_SIZE;
ret = bdrv_get_block_status(bs, sector_num, nb_sectors, &n);
if (ret < 0) {
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment