]> git.baikalelectronics.ru Git - kernel.git/commit
fanotify: Fix the checks in fanotify_fsid_equal
authorNathan Chancellor <natechancellor@gmail.com>
Fri, 27 Mar 2020 17:10:30 +0000 (10:10 -0700)
committerJan Kara <jack@suse.cz>
Mon, 30 Mar 2020 10:40:53 +0000 (12:40 +0200)
commit8ebdde96e1f3fe3b92abd5b7cec670888865c90b
tree4d186f573b767e16a911c82c38d3b8e2fb16b90c
parentfc9aabc0d0c9e998baa10e685d45870d622fe878
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: 147b2f80eb88 ("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>
fs/notify/fanotify/fanotify.c