[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202411251801.nLqLjFGW-lkp@intel.com>
Date: Mon, 25 Nov 2024 19:01:14 +0800
From: kernel test robot <lkp@...el.com>
To: Song Liu <song@...nel.org>, bpf@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-security-module@...r.kernel.org
Cc: oe-kbuild-all@...ts.linux.dev, kernel-team@...a.com, andrii@...nel.org,
eddyz87@...il.com, ast@...nel.org, daniel@...earbox.net,
martin.lau@...ux.dev, viro@...iv.linux.org.uk, brauner@...nel.org,
jack@...e.cz, kpsingh@...nel.org, mattbobrowski@...gle.com,
amir73il@...il.com, repnop@...gle.com, jlayton@...nel.org,
josef@...icpanda.com, mic@...ikod.net, gnoack@...gle.com,
Song Liu <song@...nel.org>
Subject: Re: [PATCH v3 fanotify 1/2] fanotify: Introduce fanotify filter
Hi Song,
kernel test robot noticed the following build warnings:
[auto build test WARNING on jack-fs/fsnotify]
[also build test WARNING on linus/master v6.12 next-20241125]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Song-Liu/fanotify-Introduce-fanotify-filter/20241125-110818
base: https://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs.git fsnotify
patch link: https://lore.kernel.org/r/20241122225958.1775625-2-song%40kernel.org
patch subject: [PATCH v3 fanotify 1/2] fanotify: Introduce fanotify filter
config: i386-randconfig-001-20241125 (https://download.01.org/0day-ci/archive/20241125/202411251801.nLqLjFGW-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241125/202411251801.nLqLjFGW-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411251801.nLqLjFGW-lkp@intel.com/
All warnings (new ones prefixed by >>):
fs/notify/fanotify/fanotify_filter.c: In function 'fanotify_filter_add':
>> fs/notify/fanotify/fanotify_filter.c:226:55: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
226 | if (copy_from_user(init_args, (void __user *)args.init_args,
| ^
vim +226 fs/notify/fanotify/fanotify_filter.c
156
157 /*
158 * fanotify_filter_add - Add a filter to fsnotify_group.
159 *
160 * Add a filter from filter_list to a fsnotify_group.
161 *
162 * @group: fsnotify_group that will have add
163 * @argp: fanotify_filter_args that specifies the filter
164 * and the init arguments of the filter.
165 *
166 * Returns:
167 * 0 - on success;
168 * -EEXIST - filter of the same name already exists.
169 */
170 int fanotify_filter_add(struct fsnotify_group *group,
171 struct fanotify_filter_args __user *argp)
172 {
173 struct fanotify_filter_hook *filter_hook;
174 struct fanotify_filter_ops *filter_ops;
175 struct fanotify_filter_args args;
176 void *init_args = NULL;
177 int ret = 0;
178
179 ret = copy_from_user(&args, argp, sizeof(args));
180 if (ret)
181 return -EFAULT;
182
183 if (args.init_args_size > FAN_FILTER_ARGS_MAX)
184 return -EINVAL;
185
186 args.name[FAN_FILTER_NAME_MAX - 1] = '\0';
187
188 fsnotify_group_lock(group);
189
190 if (rcu_access_pointer(group->fanotify_data.filter_hook)) {
191 fsnotify_group_unlock(group);
192 return -EBUSY;
193 }
194
195 filter_hook = kzalloc(sizeof(*filter_hook), GFP_KERNEL);
196 if (!filter_hook) {
197 ret = -ENOMEM;
198 goto out;
199 }
200
201 spin_lock(&filter_list_lock);
202 filter_ops = fanotify_filter_find(args.name);
203 if (!filter_ops || !try_module_get(filter_ops->owner)) {
204 spin_unlock(&filter_list_lock);
205 ret = -ENOENT;
206 goto err_free_hook;
207 }
208 spin_unlock(&filter_list_lock);
209
210 if (!capable(CAP_SYS_ADMIN) && (filter_ops->flags & FAN_FILTER_F_SYS_ADMIN_ONLY)) {
211 ret = -EPERM;
212 goto err_module_put;
213 }
214
215 if (filter_ops->filter_init) {
216 if (args.init_args_size != filter_ops->init_args_size) {
217 ret = -EINVAL;
218 goto err_module_put;
219 }
220 if (args.init_args_size) {
221 init_args = kzalloc(args.init_args_size, GFP_KERNEL);
222 if (!init_args) {
223 ret = -ENOMEM;
224 goto err_module_put;
225 }
> 226 if (copy_from_user(init_args, (void __user *)args.init_args,
227 args.init_args_size)) {
228 ret = -EFAULT;
229 goto err_free_args;
230 }
231
232 }
233 ret = filter_ops->filter_init(group, filter_hook, init_args);
234 if (ret)
235 goto err_free_args;
236 kfree(init_args);
237 }
238 filter_hook->ops = filter_ops;
239 rcu_assign_pointer(group->fanotify_data.filter_hook, filter_hook);
240
241 out:
242 fsnotify_group_unlock(group);
243 return ret;
244
245 err_free_args:
246 kfree(init_args);
247 err_module_put:
248 module_put(filter_ops->owner);
249 err_free_hook:
250 kfree(filter_hook);
251 goto out;
252 }
253
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Powered by blists - more mailing lists