Messages in this thread | | | From | Amir Goldstein <> | Date | Sat, 28 Mar 2020 12:15:14 +0300 | Subject | Re: [PATCH -next] fanotify: Fix the checks in fanotify_fsid_equal |
| |
On Fri, Mar 27, 2020 at 8:10 PM Nathan Chancellor <natechancellor@gmail.com> wrote: > > 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 > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com> > ---
Ouch! Good catch!
It would have been quite hard to catch this with tests as non equal fsid and equal fid are quite rare in the wild. I will try to write some test with mounts of cloned loop devs.
Thanks, Amir.
| |