[dm-devel] [PATCH 05/11] block: Limit allocation of zone descriptors for report zones
Christoph Hellwig
hch at lst.de
Wed Oct 10 13:27:14 UTC 2018
> + 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 <hch at lst.de>
More information about the dm-devel
mailing list