summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Chancellor <natechancellor@gmail.com>2020-03-27 10:10:30 -0700
committerJan Kara <jack@suse.cz>2020-03-30 12:40:53 +0200
commit6def1a1d2d58eda5834fe2e2ace4560f9cdd7de1 (patch)
tree4d186f573b767e16a911c82c38d3b8e2fb16b90c
parent44d705b0370b1d581f46ff23e5d33e8b5ff8ec58 (diff)
downloadlinux-6def1a1d2d58eda5834fe2e2ace4560f9cdd7de1.tar.gz
linux-6def1a1d2d58eda5834fe2e2ace4560f9cdd7de1.tar.bz2
linux-6def1a1d2d58eda5834fe2e2ace4560f9cdd7de1.zip
fanotify: Fix the checks in fanotify_fsid_equal
Clang warns: fs/notify/fanotify/fanotify.c:28:23: warning: self-comparison always evaluates to true [-Wtautological-compare] return fsid1->val[0] == fsid1->val[0] && fsid2->val[1] == fsid2->val[1]; ^ fs/notify/fanotify/fanotify.c:28:57: warning: self-comparison always evaluates to true [-Wtautological-compare] return fsid1->val[0] == fsid1->val[0] && fsid2->val[1] == fsid2->val[1]; ^ 2 warnings generated. The intention was clearly to compare val[0] and val[1] in the two different fsid structs. Fix it otherwise this function always returns true. Fixes: afc894c784c8 ("fanotify: Store fanotify handles differently") Link: https://github.com/ClangBuiltLinux/linux/issues/952 Link: https://lore.kernel.org/r/20200327171030.30625-1-natechancellor@gmail.com Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r--fs/notify/fanotify/fanotify.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c
index 4c1a4eb597d5..5435a40f82be 100644
--- a/fs/notify/fanotify/fanotify.c
+++ b/fs/notify/fanotify/fanotify.c
@@ -25,7 +25,7 @@ static bool fanotify_path_equal(struct path *p1, struct path *p2)
static inline bool fanotify_fsid_equal(__kernel_fsid_t *fsid1,
__kernel_fsid_t *fsid2)
{
- return fsid1->val[0] == fsid1->val[0] && fsid2->val[1] == fsid2->val[1];
+ return fsid1->val[0] == fsid2->val[0] && fsid1->val[1] == fsid2->val[1];
}
static bool fanotify_fh_equal(struct fanotify_fh *fh1,