Message ID | da48fbb7-ec78-f382-919e-cdf23fa200db@kernel.dk (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | block: add a BUILD_BUG_ON() for adding more bio flags than we have space | expand |
On 1/10/23 02:47, Jens Axboe wrote: > 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@kernel.dk> > > --- > > 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++) { > Looks OK to me. Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
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++) {
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@kernel.dk> ---