Skip to content

Commit 7a102d9

Browse files
JackieLiu1axboe
authored andcommitted
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]>
1 parent 47ca23c commit 7a102d9

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

block/bio-integrity.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ struct bio_integrity_payload *bio_integrity_alloc(struct bio *bio,
4343
unsigned inline_vecs;
4444

4545
if (!bs || !mempool_initialized(&bs->bio_integrity_pool)) {
46-
bip = kmalloc(sizeof(struct bio_integrity_payload) +
47-
sizeof(struct bio_vec) * nr_vecs, gfp_mask);
46+
bip = kmalloc(struct_size(bip, bip_inline_vecs, nr_vecs), gfp_mask);
4847
inline_vecs = nr_vecs;
4948
} else {
5049
bip = mempool_alloc(&bs->bio_integrity_pool, gfp_mask);

0 commit comments

Comments
 (0)