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-block" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to