Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

block: add a BUILD_BUG_ON() for adding more bio flags than we have space

We have BIO_FLAG_LAST in the enum for bio specific flags, but it's
not used to check that we're not exceeding the size of them. Add
such a check.

Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

+2
+2
block/bio.c
··· 1792 1792 { 1793 1793 int i; 1794 1794 1795 + BUILD_BUG_ON(BIO_FLAG_LAST > 8 * sizeof_field(struct bio, bi_flags)); 1796 + 1795 1797 bio_integrity_init(); 1796 1798 1797 1799 for (i = 0; i < ARRAY_SIZE(bvec_slabs); i++) {