]> Git Repo - linux.git/commitdiff
fanotify: Fix the checks in fanotify_fsid_equal
authorNathan Chancellor <[email protected]>
Fri, 27 Mar 2020 17:10:30 +0000 (10:10 -0700)
committerJan Kara <[email protected]>
Mon, 30 Mar 2020 10:40:53 +0000 (12:40 +0200)
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/[email protected]
Signed-off-by: Nathan Chancellor <[email protected]>
Reviewed-by: Nick Desaulniers <[email protected]>
Signed-off-by: Jan Kara <[email protected]>
fs/notify/fanotify/fanotify.c

index 4c1a4eb597d5c51170728110926adc1ab5b32b14..5435a40f82bec95b140451057ca8415f36f5381e 100644 (file)
@@ -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,
This page took 0.056859 seconds and 4 git commands to generate.