Commit 7a102d90 authored by Jackie Liu's avatar Jackie Liu Committed by Jens Axboe

block/bio-integrity: use struct_size() in kmalloc()

Use the new struct_size() helper to keep code simple.
Reviewed-by: default avatarChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: default avatarJackie Liu <liuyun01@kylinos.cn>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 47ca23c1
...@@ -43,8 +43,7 @@ struct bio_integrity_payload *bio_integrity_alloc(struct bio *bio, ...@@ -43,8 +43,7 @@ struct bio_integrity_payload *bio_integrity_alloc(struct bio *bio,
unsigned inline_vecs; unsigned inline_vecs;
if (!bs || !mempool_initialized(&bs->bio_integrity_pool)) { if (!bs || !mempool_initialized(&bs->bio_integrity_pool)) {
bip = kmalloc(sizeof(struct bio_integrity_payload) + bip = kmalloc(struct_size(bip, bip_inline_vecs, nr_vecs), gfp_mask);
sizeof(struct bio_vec) * nr_vecs, gfp_mask);
inline_vecs = nr_vecs; inline_vecs = nr_vecs;
} else { } else {
bip = mempool_alloc(&bs->bio_integrity_pool, gfp_mask); bip = mempool_alloc(&bs->bio_integrity_pool, gfp_mask);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment