Commit d4e6e836 authored by Zhengyuan Liu's avatar Zhengyuan Liu Committed by Mike Snitzer

dm log writes: use struct_size() to calculate size of pending_block

Use struct_size() to avoid open-coded equivalent that is prone to a type
mistake.
Signed-off-by: default avatarZhengyuan Liu <liuzhengyuan@kylinos.cn>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent 9c81c99b
......@@ -699,7 +699,7 @@ static int log_writes_map(struct dm_target *ti, struct bio *bio)
if (discard_bio)
alloc_size = sizeof(struct pending_block);
else
alloc_size = sizeof(struct pending_block) + sizeof(struct bio_vec) * bio_segments(bio);
alloc_size = struct_size(block, vecs, bio_segments(bio));
block = kzalloc(alloc_size, GFP_NOIO);
if (!block) {
......
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