summaryrefslogtreecommitdiff
path: root/drivers/md/persistent-data
diff options
context:
space:
mode:
authorHuaisheng Ye <yehs1@lenovo.com>2020-09-15 11:56:08 +0300
committerMike Snitzer <snitzer@redhat.com>2020-09-29 23:33:11 +0300
commit399c9bdbd6500254895bdbb574a4acbb860cda41 (patch)
tree4effef942c2e9ace98ed1e13bd89565477f74561 /drivers/md/persistent-data
parentf0e90b6c663a7e3b4736cb318c6c7c589f152c28 (diff)
downloadlinux-399c9bdbd6500254895bdbb574a4acbb860cda41.tar.xz
dm thin metadata: Remove unused local variable when create thin and snap
The local variable disk details is not used during the creating of thin & snap devices. Remove them from dm-thin-metadata, and add pointer validity check for pointer value in btree_lookup_raw. Skip memory copy when the caller doesn't need the value. Signed-off-by: Huaisheng Ye <yehs1@lenovo.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/persistent-data')
-rw-r--r--drivers/md/persistent-data/dm-btree.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c
index 8aae0624a297..ef6e78d45d5b 100644
--- a/drivers/md/persistent-data/dm-btree.c
+++ b/drivers/md/persistent-data/dm-btree.c
@@ -366,7 +366,8 @@ static int btree_lookup_raw(struct ro_spine *s, dm_block_t block, uint64_t key,
} while (!(flags & LEAF_NODE));
*result_key = le64_to_cpu(ro_node(s)->keys[i]);
- memcpy(v, value_ptr(ro_node(s), i), value_size);
+ if (v)
+ memcpy(v, value_ptr(ro_node(s), i), value_size);
return 0;
}