Thread (18 messages) 18 messages, 4 authors, 2016-09-20

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

flat view

From: Bart Van Assche <hidden>
Date: 2016-09-20 04:19:03
Also in: linux-scsi

On 09/19/16 14:27, Damien Le Moal wrote:
quoted hunk ↗ jump to hunk
+	/*
+	 * 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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help