mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-01 16:14:13 +08:00
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: Zhengyuan Liu <liuzhengyuan@kylinos.cn> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
This commit is contained in:
parent
9c81c99b24
commit
d4e6e83651
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user