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. Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> --- diff --git a/block/bio.c b/block/bio.c index 5f96fcae3f75..633d1a2af785 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1785,6 +1785,8 @@ static int __init init_bio(void) { int i; + BUILD_BUG_ON(BIO_FLAG_LAST > 8 * sizeof_field(struct bio, bi_flags)); + bio_integrity_init(); for (i = 0; i < ARRAY_SIZE(bvec_slabs); i++) { -- Jens Axboe