block: add a BUILD_BUG_ON() for adding more bio flags than we have space
Jens Axboe
maintainerPATCH 1/1 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.
Signed-off-by Jens Axboe <[email protected]>
---
block/bio.c +2 -0
@@ -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++) {
Signature · 1 line
Jens Axboe
Quoted 14 lines · Jens Axboe
We have
BIO_FLAG_LASTin 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 <[email protected]>---
block/bio.c +0
-0
block/bio.c static int __init init_bio(void) · line 1792
Quoted 8 lines
block/bio.c +2
-0@@ -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++) {
Looks OK to me.
Reviewed-by Damien Le Moal <[email protected]>
Signature · 2 lines
Damien Le Moal Western Digital Research
Looks good,
Reviewed-by Johannes Thumshirn <[email protected]>