Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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) {