summaryrefslogtreecommitdiffstats
path: root/misc-utils/lsblk-devtree.c
diff options
context:
space:
mode:
authorSami Kerola2018-12-10 21:14:12 +0100
committerSami Kerola2018-12-10 21:25:58 +0100
commite361253e886424cbe37693d92eb368a595fd9e9a (patch)
treef0efe72ccd89f63659f2fc46f6937c78d57a2ec5 /misc-utils/lsblk-devtree.c
parentlibmount: (umount) make mnt_stat_mountpoin() usable for relative paths (diff)
downloadkernel-qcow2-util-linux-e361253e886424cbe37693d92eb368a595fd9e9a.tar.gz
kernel-qcow2-util-linux-e361253e886424cbe37693d92eb368a595fd9e9a.tar.xz
kernel-qcow2-util-linux-e361253e886424cbe37693d92eb368a595fd9e9a.zip
lsblk: fix null pointer dereferences
Both catched with -Wnull-dereference compiler option: Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'misc-utils/lsblk-devtree.c')
-rw-r--r--misc-utils/lsblk-devtree.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/misc-utils/lsblk-devtree.c b/misc-utils/lsblk-devtree.c
index 82db4f8cf..a2aa26aed 100644
--- a/misc-utils/lsblk-devtree.c
+++ b/misc-utils/lsblk-devtree.c
@@ -203,7 +203,8 @@ int lsblk_device_is_last_parent(struct lsblk_device *dev, struct lsblk_device *p
struct lsblk_devdep *dp = list_last_entry(
&dev->parents,
struct lsblk_devdep, ls_parents);
-
+ if (!dp)
+ return 0;
return dp->parent == parent;
}