Skip to content

Commit

Permalink
fanotify_user: use upper_32_bits() to verify mask
Browse files Browse the repository at this point in the history
I don't see an obvious reason why the upper 32 bit check needs to be
open-coded this way. Switch to upper_32_bits() which is more idiomatic and
should conceptually be the same check.

Cc: Amir Goldstein <amir73il@gmail.com>
Cc: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20210325083742.2334933-1-brauner@kernel.org
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Jan Kara <jack@suse.cz>
  • Loading branch information
Christian Brauner authored and Jan Kara committed Mar 25, 2021
1 parent 7cea2a3 commit 22d483b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/notify/fanotify/fanotify_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -1250,7 +1250,7 @@ static int do_fanotify_mark(int fanotify_fd, unsigned int flags, __u64 mask,
__func__, fanotify_fd, flags, dfd, pathname, mask);

/* we only use the lower 32 bits as of right now. */
if (mask & ((__u64)0xffffffff << 32))
if (upper_32_bits(mask))
return -EINVAL;

if (flags & ~FANOTIFY_MARK_FLAGS)
Expand Down

0 comments on commit 22d483b

Please sign in to comment.