public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: silence a cppcheck warning
@ 2020-12-10 23:57 Gao Xiang
  2020-12-11  1:17 ` Dave Chinner
  0 siblings, 1 reply; 4+ messages in thread
From: Gao Xiang @ 2020-12-10 23:57 UTC (permalink / raw)
  To: linux-xfs; +Cc: Darrick J. Wong, Brian Foster, Gao Xiang

This patch silences a new cppcheck static analysis warning
>> fs/xfs/libxfs/xfs_sb.c:367:21: warning: Boolean result is used in bitwise operation. Clarify expression with parentheses. [clarifyCondition]
    if (!!sbp->sb_unit ^ xfs_sb_version_hasdalign(sbp)) {

introduced from my patch. Sorry I didn't test it with cppcheck before.

Signed-off-by: Gao Xiang <hsiangkao@redhat.com>
---
 fs/xfs/libxfs/xfs_sb.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c
index bbda117e5d85..ae5df66c2fa0 100644
--- a/fs/xfs/libxfs/xfs_sb.c
+++ b/fs/xfs/libxfs/xfs_sb.c
@@ -360,11 +360,8 @@ xfs_validate_sb_common(
 		}
 	}
 
-	/*
-	 * Either (sb_unit and !hasdalign) or (!sb_unit and hasdalign)
-	 * would imply the image is corrupted.
-	 */
-	if (!!sbp->sb_unit ^ xfs_sb_version_hasdalign(sbp)) {
+	if ((sbp->sb_unit && !xfs_sb_version_hasdalign(sbp)) ||
+	    (!sbp->sb_unit && xfs_sb_version_hasdalign(sbp))) {
 		xfs_notice(mp, "SB stripe alignment sanity check failed");
 		return -EFSCORRUPTED;
 	}
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-12-11  3:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-10 23:57 [PATCH] xfs: silence a cppcheck warning Gao Xiang
2020-12-11  1:17 ` Dave Chinner
2020-12-11  2:09   ` Gao Xiang
2020-12-11  3:25     ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox