From: Gao Xiang <hsiangkao@redhat.com>
To: linux-xfs@vger.kernel.org
Cc: "Darrick J. Wong" <darrick.wong@oracle.com>,
Brian Foster <bfoster@redhat.com>,
Gao Xiang <hsiangkao@redhat.com>
Subject: [PATCH] xfs: silence a cppcheck warning
Date: Fri, 11 Dec 2020 07:57:47 +0800 [thread overview]
Message-ID: <20201210235747.469708-1-hsiangkao@redhat.com> (raw)
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
next reply other threads:[~2020-12-11 0:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-10 23:57 Gao Xiang [this message]
2020-12-11 1:17 ` [PATCH] xfs: silence a cppcheck warning Dave Chinner
2020-12-11 2:09 ` Gao Xiang
2020-12-11 3:25 ` Dave Chinner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201210235747.469708-1-hsiangkao@redhat.com \
--to=hsiangkao@redhat.com \
--cc=bfoster@redhat.com \
--cc=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox