Skip to content

Commit dccd855

Browse files
Vasily Averinjankara
authored andcommitted
fanotify: fix incorrect fmode_t casts
Fixes sparce warnings: fs/notify/fanotify/fanotify_user.c:267:63: sparse: warning: restricted fmode_t degrades to integer fs/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. Signed-off-by: Vasily Averin <vvs@openvz.org> Reviewed-by: Christian Brauner (Microsoft) <brauner@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jan Kara <jack@suse.cz> Link: https://lore.kernel.org/r/9adfd6ac-1b89-791e-796b-49ada3293985@openvz.org
1 parent e730558 commit dccd855

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

fs/notify/fanotify/fanotify_user.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ static int create_fd(struct fsnotify_group *group, struct path *path,
264264
* originally opened O_WRONLY.
265265
*/
266266
new_file = dentry_open(path,
267-
group->fanotify_data.f_flags | FMODE_NONOTIFY,
267+
group->fanotify_data.f_flags | __FMODE_NONOTIFY,
268268
current_cred());
269269
if (IS_ERR(new_file)) {
270270
/*
@@ -1377,7 +1377,7 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags)
13771377
(!(fid_mode & FAN_REPORT_NAME) || !(fid_mode & FAN_REPORT_FID)))
13781378
return -EINVAL;
13791379

1380-
f_flags = O_RDWR | FMODE_NONOTIFY;
1380+
f_flags = O_RDWR | __FMODE_NONOTIFY;
13811381
if (flags & FAN_CLOEXEC)
13821382
f_flags |= O_CLOEXEC;
13831383
if (flags & FAN_NONBLOCK)

0 commit comments

Comments
 (0)