Skip to contentSkip to conversation

lib: [loopdev.c] fix use of logical '&&' with constant operand

PATCH Applied Francesco Cosoleto 2 participants 4 messages Sep 15, 2011 – Sep 27, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 lib: [loopdev.c] fix use of logical '&&' with constant operand

Found by clang.

---
 lib/loopdev.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
lib/loopdev.c +2 -2
index 81b7d2d..7c095ee 100644
@@ -116,7 +116,7 @@ int loopcxt_init(struct loopdev_cxt *lc, int flags)
 	lc->flags = flags;
 	loopcxt_set_device(lc, NULL);
 
-	if (!(lc->flags && LOOPDEV_FL_NOSYSFS) &&
+	if (!(lc->flags & LOOPDEV_FL_NOSYSFS) &&
 	    get_linux_version() >= KERNEL_VERSION(2,6,37))
 		/*
 		 * Use only sysfs for basic information about loop devices
@@ -244,7 +244,7 @@ int loopcxt_init_iterator(struct loopdev_cxt *lc, int flags)
 		/*
 		 * Check for /dev/loop/<N> subdirectory
 		 */
-		if (!(lc->flags && LOOPDEV_FL_DEVSUBDIR) &&
+		if (!(lc->flags & LOOPDEV_FL_DEVSUBDIR) &&
 		    stat(_PATH_DEV_LOOP, &st) == 0 && S_ISDIR(st.st_mode))
 			lc->flags |= LOOPDEV_FL_DEVSUBDIR;
 
Signature · 1 line
1.7.3.4
#1 lore raw

PATCH 2/2 libmount: fix use of logical '&&' with constant operand

Found by clang.

---
 libmount/src/context_loopdev.c |    2 +-
 libmount/src/context_mount.c   |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
libmount/src/context_loopdev.c +1 -1
index 6ed0df1..992472e 100644
@@ -52,7 +52,7 @@ int mnt_context_is_loopdev(struct libmnt_context *cxt)
 	type = mnt_fs_get_fstype(cxt->fs);
 	fl = __mnt_fs_get_flags(cxt->fs);
 
-	if (!(fl && (MNT_FS_PSEUDO | MNT_FS_NET | MNT_FS_SWAP)) &&
+	if (!(fl & (MNT_FS_PSEUDO | MNT_FS_NET | MNT_FS_SWAP)) &&
 	    (!type || strcmp(type, "auto") == 0 || blkid_known_fstype(type))) {
 		struct stat st;
 
libmount/src/context_mount.c +1 -1
index 7e75ad7..bcc4cdd 100644
@@ -125,7 +125,7 @@ static int fix_optstr(struct libmnt_context *cxt)
 			goto done;
 	}
 
-	if (!rc && cxt->user_mountflags && MNT_MS_USER)
+	if (!rc && cxt->user_mountflags & MNT_MS_USER)
 		rc = mnt_optstr_fix_user(&fs->user_optstr);
 
 	/* refresh merged optstr */
Signature · 1 line
1.7.3.4
maintainer Applied
#2 lore raw

Re: [PATCH 2/2] libmount: fix use of logical '&&' with constant operand

Quoted 3 lines · Francesco Cosoleto
 libmount/src/context_loopdev.c |    2 +-
 libmount/src/context_mount.c   |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Applied, thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com