Re: [PATCH 5/9] block: Implement support for zoned block devices

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

 



On 09/19/16 14:27, Damien Le Moal wrote:
+	/*
+	 * Make sure bi_size does not overflow because
+	 * of some weird very large zone size.
+	 */
+	if (nr_sects && (unsigned long long)nr_sects << 9 > UINT_MAX)
+		return -EINVAL;
+
+	bio = bio_alloc(gfp_mask, 1);
+	if (!bio)
+		return -ENOMEM;
+
+	bio->bi_iter.bi_sector = sector;
+	bio->bi_iter.bi_size = nr_sects << 9;
+	bio->bi_vcnt = 0;
+	bio->bi_bdev = bdev;
+	bio_set_op_attrs(bio, op, 0);

Hello Damien and Hannes,

nr_sects is cast to unsigned long long for the overflow test but not when assigning bi_size. To me this looks like an inconsistency. Please make both expressions consistent.

Thanks,

Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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