Skip to content

Commit 6def1a1

Browse files
nathanchancejankara
authored andcommitted
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: afc894c ("fanotify: Store fanotify handles differently") Link: ClangBuiltLinux/linux#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]>
1 parent 44d705b commit 6def1a1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/notify/fanotify/fanotify.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ static bool fanotify_path_equal(struct path *p1, struct path *p2)
2525
static inline bool fanotify_fsid_equal(__kernel_fsid_t *fsid1,
2626
__kernel_fsid_t *fsid2)
2727
{
28-
return fsid1->val[0] == fsid1->val[0] && fsid2->val[1] == fsid2->val[1];
28+
return fsid1->val[0] == fsid2->val[0] && fsid1->val[1] == fsid2->val[1];
2929
}
3030

3131
static bool fanotify_fh_equal(struct fanotify_fh *fh1,

0 commit comments

Comments
 (0)