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>



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux