fanotify_user: use upper_32_bits() to verify mask
Subsystems (3)
Christian Brauner
maintainerPATCH 1/1 fanotify_user: use upper_32_bits() to verify mask
From: Christian Brauner <[email protected]>
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 <[email protected]>
Cc Jan Kara <[email protected]>
Signed-off-by Christian Brauner <[email protected]>
--- fs/notify/fanotify/fanotify_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/notify/fanotify/fanotify_user.c +1 -1
@@ -1126,7 +1126,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 )
base-commit: 0d02ec6b3136c73c09e7859f0d0e4e2c4c07b49b
Signature · 1 line
2.27.0
Jan Kara
maintainerQuoted 9 lines · Christian Brauner
From: Christian Brauner <[email protected]>
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 <[email protected]>Cc Jan Kara <[email protected]>Signed-off-by Christian Brauner <[email protected]>
Thanks for the cleanup. I've added it to my tree.
Honza
Quoted 22 lines
--- fs/notify/fanotify/fanotify_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/notify/fanotify/fanotify_user.c +1
-1@@ -1126,7 +1126,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 )base-commit:
0d02ec6b3136c73c09e7859f0d0e4e2c4c07b49bSignature · 1 line
2.27.0
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR