From: Jens Axboe Date: Mon, 9 Jan 2023 17:45:56 +0000 (-0700) Subject: block: add a BUILD_BUG_ON() for adding more bio flags than we have space X-Git-Tag: for-6.3/block-2023-02-16~143 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=a3df2e456c0f9db4cc7f2013eb0beb853945b937;p=linux-block.git 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 Signed-off-by: Jens Axboe --- diff --git a/block/bio.c b/block/bio.c index ab59a491a883..d7fbc7adfc50 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1792,6 +1792,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++) {