[PATCH] xfs: silence a cppcheck warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux