> +     unsigned int nr_zones;
>       int ret;
>  
>       if (!argp)
> @@ -355,8 +356,9 @@ int blkdev_report_zones_ioctl(struct block_device *bdev, 
> fmode_t mode,
>       if (!rep.nr_zones)
>               return -EINVAL;
>  
> -     if (rep.nr_zones > INT_MAX / sizeof(struct blk_zone))
> -             return -ERANGE;
> +     nr_zones = blkdev_nr_zones(bdev);
> +     if (rep.nr_zones > nr_zones)
> +             rep.nr_zones = nr_zones;

This could be further simplified using min_t, but othewise it looks fine
to me:

Reviewed-by: Christoph Hellwig <h...@lst.de>

Reply via email to