mirror of
https://github.com/torvalds/linux.git
synced 2026-10-07 05:31:08 -04:00
block/bio-integrity: use struct_size() in kmalloc()
Use the new struct_size() helper to keep code simple. Reviewed-by: Chaitanya Kulkarni <[email protected]> Signed-off-by: Jackie Liu <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
1 parent
47ca23c117
commit
7a102d9044
1 file changed
+1
-2
@@ -43,8 +43,7 @@ struct bio_integrity_payload *bio_integrity_alloc(struct bio *bio,
|
||||
unsigned inline_vecs;
|
||||
|
||||
if (!bs || !mempool_initialized(&bs->bio_integrity_pool)) {
|
||||
bip = kmalloc(sizeof(struct bio_integrity_payload) +
|
||||
sizeof(struct bio_vec) * nr_vecs, gfp_mask);
|
||||
bip = kmalloc(struct_size(bip, bip_inline_vecs, nr_vecs), gfp_mask);
|
||||
inline_vecs = nr_vecs;
|
||||
} else {
|
||||
bip = mempool_alloc(&bs->bio_integrity_pool, gfp_mask);
|
||||
|
||||
Reference in new issue
Block a user