OSDN Git Service
(root)
/
uclinux-h8
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9c81c99
)
dm log writes: use struct_size() to calculate size of pending_block
author
Zhengyuan Liu
<liuzhengyuan@kylinos.cn>
Wed, 12 Jun 2019 06:14:46 +0000
(14:14 +0800)
committer
Mike Snitzer
<snitzer@redhat.com>
Tue, 9 Jul 2019 18:08:41 +0000
(14:08 -0400)
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>
drivers/md/dm-log-writes.c
patch
|
blob
|
history
diff --git
a/drivers/md/dm-log-writes.c
b/drivers/md/dm-log-writes.c
index
e549392
..
0837b17
100644
(file)
--- a/
drivers/md/dm-log-writes.c
+++ b/
drivers/md/dm-log-writes.c
@@
-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 = s
izeof(struct pending_block) + sizeof(struct bio_vec) * bio_segments(bio
);
+ alloc_size = s
truct_size(block, vecs, bio_segments(bio)
);
block = kzalloc(alloc_size, GFP_NOIO);
if (!block) {