summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorJackie Liu <liuyun01@kylinos.cn>2019-05-15 10:52:19 +0200
committerJens Axboe <axboe@kernel.dk>2019-05-16 16:48:48 +0200
commit7a102d9044e720ac887c0cd82b6d5cad236f6d71 (patch)
tree7bd4c85df02657d132a96bbebfcf36c342977977 /block
parentMerge branch 'nvme-5.2' of git://git.infradead.org/nvme into for-5.2/block-post (diff)
downloadlinux-7a102d9044e720ac887c0cd82b6d5cad236f6d71.tar.xz
linux-7a102d9044e720ac887c0cd82b6d5cad236f6d71.zip
block/bio-integrity: use struct_size() in kmalloc()
Use the new struct_size() helper to keep code simple. Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> Signed-off-by: Jackie Liu <liuyun01@kylinos.cn> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r--block/bio-integrity.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index 42536674020a..4db620849515 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -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);