]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-5.15/fanotify-fix-incorrect-fmode_t-casts.patch
Fixes for 5.15
[thirdparty/kernel/stable-queue.git] / queue-5.15 / fanotify-fix-incorrect-fmode_t-casts.patch
1 From 7766bc9976d4eafd4553be61983fb04cd78c32d1 Mon Sep 17 00:00:00 2001
2 From: Sasha Levin <sashal@kernel.org>
3 Date: Sun, 22 May 2022 15:08:02 +0300
4 Subject: fanotify: fix incorrect fmode_t casts
5
6 From: Vasily Averin <vvs@openvz.org>
7
8 [ Upstream commit dccd855771b37820b6d976a99729c88259549f85 ]
9
10 Fixes sparce warnings:
11 fs/notify/fanotify/fanotify_user.c:267:63: sparse:
12 warning: restricted fmode_t degrades to integer
13 fs/notify/fanotify/fanotify_user.c:1351:28: sparse:
14 warning: restricted fmode_t degrades to integer
15
16 FMODE_NONTIFY have bitwise fmode_t type and requires __force attribute
17 for any casts.
18
19 Signed-off-by: Vasily Averin <vvs@openvz.org>
20 Reviewed-by: Christian Brauner (Microsoft) <brauner@kernel.org>
21 Reviewed-by: Christoph Hellwig <hch@lst.de>
22 Signed-off-by: Jan Kara <jack@suse.cz>
23 Link: https://lore.kernel.org/r/9adfd6ac-1b89-791e-796b-49ada3293985@openvz.org
24 Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
25 ---
26 fs/notify/fanotify/fanotify_user.c | 4 ++--
27 1 file changed, 2 insertions(+), 2 deletions(-)
28
29 diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
30 index 4471043955f87..6db5a0b03a78d 100644
31 --- a/fs/notify/fanotify/fanotify_user.c
32 +++ b/fs/notify/fanotify/fanotify_user.c
33 @@ -260,7 +260,7 @@ static int create_fd(struct fsnotify_group *group, struct path *path,
34 * originally opened O_WRONLY.
35 */
36 new_file = dentry_open(path,
37 - group->fanotify_data.f_flags | FMODE_NONOTIFY,
38 + group->fanotify_data.f_flags | __FMODE_NONOTIFY,
39 current_cred());
40 if (IS_ERR(new_file)) {
41 /*
42 @@ -1373,7 +1373,7 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags)
43 (!(fid_mode & FAN_REPORT_NAME) || !(fid_mode & FAN_REPORT_FID)))
44 return -EINVAL;
45
46 - f_flags = O_RDWR | FMODE_NONOTIFY;
47 + f_flags = O_RDWR | __FMODE_NONOTIFY;
48 if (flags & FAN_CLOEXEC)
49 f_flags |= O_CLOEXEC;
50 if (flags & FAN_NONBLOCK)
51 --
52 2.43.0
53