From 96bc8588b238deccfc1b0204327a53f32b0f52ea Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 12 Sep 2011 16:01:42 +0200 Subject: [PATCH] libmount: previously assumed null pointer [smatch scan] Signed-off-by: Karel Zak --- libmount/src/tab.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libmount/src/tab.c b/libmount/src/tab.c index 1eaa9dc38a..c06409d290 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) -- 2.47.2