Re: [PATCH 05/11] block: Limit allocation of zone descriptors for report zones

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> +	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@xxxxxx>

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel



[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux