summaryrefslogtreecommitdiffstats
path: root/libmount/src/tab.c
diff options
context:
space:
mode:
authorKarel Zak2011-09-12 16:01:42 +0200
committerKarel Zak2011-09-12 16:01:42 +0200
commit96bc8588b238deccfc1b0204327a53f32b0f52ea (patch)
treef832d7c4ca972d3db412954dae294f812f0c79ae /libmount/src/tab.c
parentkill: potential null derefence [smatch scan] (diff)
downloadkernel-qcow2-util-linux-96bc8588b238deccfc1b0204327a53f32b0f52ea.tar.gz
kernel-qcow2-util-linux-96bc8588b238deccfc1b0204327a53f32b0f52ea.tar.xz
kernel-qcow2-util-linux-96bc8588b238deccfc1b0204327a53f32b0f52ea.zip
libmount: previously assumed null pointer [smatch scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/tab.c')
-rw-r--r--libmount/src/tab.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libmount/src/tab.c b/libmount/src/tab.c
index 1eaa9dc38..c06409d29 100644
--- a/libmount/src/tab.c
+++ b/libmount/src/tab.c
@@ -506,7 +506,7 @@ struct libmnt_fs *mnt_table_find_srcpath(struct libmnt_table *tb, const char *pa
if (path == NULL && src == NULL)
return fs; /* source is "none" */
- if (p && strcmp(p, path) == 0)
+ if (path && p && strcmp(p, path) == 0)
return fs;
if (!p && src)
ntags++; /* mnt_fs_get_srcpath() returs nothing, it's TAG */
@@ -845,7 +845,7 @@ int mnt_table_is_fs_mounted(struct libmnt_table *tb, struct libmnt_fs *fstab_fs)
tgt = mnt_fs_get_target(fstab_fs);
- if (tgt || src || root) {
+ if (tgt && src && root) {
struct libmnt_iter itr;
struct libmnt_fs *fs;
@@ -856,8 +856,8 @@ int mnt_table_is_fs_mounted(struct libmnt_table *tb, struct libmnt_fs *fstab_fs)
*t = mnt_fs_get_target(fs),
*r = mnt_fs_get_root(fs);
- if (s && t && r && !strcmp(t, tgt) &&
- !strcmp(s, src) && !strcmp(r, root))
+ if (t && s && r &&
+ !strcmp(t, tgt) && !strcmp(s, src) && !strcmp(r, root))
break;
}
if (fs)