fanotify: fix incorrect fmode_t casts
Subsystems (3)
PATCH v3 1/1 fanotify: fix incorrect fmode_t casts
Fixes sparce warnings:fs/notify/fanotify/fanotify_user.c:267:63: sparse:
warning: restricted fmode_t degrades to integerfs/notify/fanotify/fanotify_user.c:1351:28: sparse:
warning: restricted fmode_t degrades to integer
FMODE_NONTIFY have bitwise fmode_t type and requires __force attribute for any casts.
---
v3: split, according to Christoph Hellwig recommendation
--- fs/notify/fanotify/fanotify_user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/notify/fanotify/fanotify_user.c +2 -2
@@ -264,7 +264,7 @@ static int create_fd(struct fsnotify_group *group, struct path *path,* originally opened O_WRONLY. */ new_file =dentry_open (path, - group->fanotify_data.f_flags |FMODE_NONOTIFY , + group->fanotify_data.f_flags | __FMODE_NONOTIFY,current_cred ());if (IS_ERR (new_file)) {/*
@@ -1348,7 +1348,7 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags) (!(fid_mode & FAN_REPORT_NAME) || !(fid_mode & FAN_REPORT_FID)))return -EINVAL ; - f_flags =O_RDWR |FMODE_NONOTIFY ; + f_flags =O_RDWR | __FMODE_NONOTIFY;if (flags &FAN_CLOEXEC ) f_flags |=O_CLOEXEC ;if (flags &FAN_NONBLOCK )
Signature · 1 line
2.36.1
Looks good:
Jan Kara
maintainerQuoted 11 lines · Vasily Averin
Fixes sparce warnings:
fs/notify/fanotify/fanotify_user.c:267:63: sparse:
warning: restrictedfmode_tdegrades to integerfs/notify/fanotify/fanotify_user.c:1351:28: sparse:
warning: restrictedfmode_tdegrades to integer
FMODE_NONTIFYhave bitwisefmode_ttype and requires__forceattribute for any casts.Signed-off-by Vasily Averin <[email protected]>
Thanks. I've merged the patch to my tree.
Honza
Quoted 31 lines
---
v3: split, according to Christoph Hellwig recommendation--- fs/notify/fanotify/fanotify_user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)fs/notify/fanotify/fanotify_user.c +2
-2@@ -264,7 +264,7 @@ static int create_fd(struct fsnotify_group *group, struct path *path,* originally opened O_WRONLY. */ new_file =dentry_open (path, - group->fanotify_data.f_flags |FMODE_NONOTIFY , + group->fanotify_data.f_flags | __FMODE_NONOTIFY,current_cred ());if (IS_ERR (new_file)) {/* @@ -1348,7 +1348,7 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags) (!(fid_mode & FAN_REPORT_NAME) || !(fid_mode & FAN_REPORT_FID)))return -EINVAL ; - f_flags =O_RDWR |FMODE_NONOTIFY ; + f_flags =O_RDWR | __FMODE_NONOTIFY;if (flags &FAN_CLOEXEC ) f_flags |=O_CLOEXEC ;if (flags &FAN_NONBLOCK )Signature · 1 line
2.36.1
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR