fs/incfs/vfs.c:1222 ioctl_create_file() warn: 'named_file_dentry' is an error pointer or valid
PATCH 9912/30000 fs/incfs/vfs.c:1222 ioctl_create_file() warn: 'named_file_dentry' is an error pointer or valid
tree: https://github.com/intel/linux-intel-lts.git 4.19/android_s head: 84d5fc421289417e51781e27e64fbb0fc44216ae commit: 040942fc50b20325bb56737c32b303268bb6f35c [9912/30000] ANDROID: Initial commit of Incremental FS config: x86_64-randconfig-161-20240914 (https://download.01.org/0day-ci/archive/20240922/[email protected]/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
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 <[email protected]> | Reported-by: Dan Carpenter <[email protected]> | Closes: https://lore.kernel.org/r/[email protected]/
smatch warnings:fs/incfs/vfs.c:1222 ioctl_create_file() warn: 'named_file_dentry' is an error pointer or valid fs/incfs/vfs.c:2153 incfs_mount_fs() warn: passing zero to 'ERR_PTR'
vim +/named_file_dentry +1222 fs/incfs/vfs.c
040942fc50b203 Eugene Zemtsov 2019-11-18 1213 if (parent_dir_path.dentry == mi->mi_index_dir) {
040942fc50b203 Eugene Zemtsov 2019-11-18 1214 /* Can't create a file directly inside .index */
040942fc50b203 Eugene Zemtsov 2019-11-18 1215 error = -EBUSY;
040942fc50b203 Eugene Zemtsov 2019-11-18 1216 goto out;
040942fc50b203 Eugene Zemtsov 2019-11-18 1217 }
040942fc50b203 Eugene Zemtsov 2019-11-18 1218
040942fc50b203 Eugene Zemtsov 2019-11-18 1219 /* Look up a dentry in the parent dir. It should be negative. */
040942fc50b203 Eugene Zemtsov 2019-11-18 1220 named_file_dentry = incfs_lookup_dentry(parent_dir_path.dentry,
040942fc50b203 Eugene Zemtsov 2019-11-18 1221 file_name);040942fc50b203 Eugene Zemtsov 2019-11-18 @1222 if (!named_file_dentry) {
incfs_lookup_dentry() never returns NULL, only error pointers. There are some VFS functions which return NULL for File NOT Found and error pointer for other types of errors. Explained in my blog:
https://staticthinking.wordpress.com/2022/08/01/mixing-error-pointers-and-null/
But this isn't one of those.
This file has other similar issues, which the zero day bot does not find.
040942fc50b203 Eugene Zemtsov 2019-11-18 1223 error = -EFAULT;
040942fc50b203 Eugene Zemtsov 2019-11-18 1224 goto out;
040942fc50b203 Eugene Zemtsov 2019-11-18 1225 }
040942fc50b203 Eugene Zemtsov 2019-11-18 1226 if (IS_ERR(named_file_dentry)) {
040942fc50b203 Eugene Zemtsov 2019-11-18 1227 error = PTR_ERR(named_file_dentry);
040942fc50b203 Eugene Zemtsov 2019-11-18 1228 named_file_dentry = NULL;
040942fc50b203 Eugene Zemtsov 2019-11-18 1229 goto out;
040942fc50b203 Eugene Zemtsov 2019-11-18 1230 }
040942fc50b203 Eugene Zemtsov 2019-11-18 1231 if (d_really_is_positive(named_file_dentry)) {
040942fc50b203 Eugene Zemtsov 2019-11-18 1232 /* File with this path already exists. */
040942fc50b203 Eugene Zemtsov 2019-11-18 1233 error = -EEXIST;
040942fc50b203 Eugene Zemtsov 2019-11-18 1234 goto out;
040942fc50b203 Eugene Zemtsov 2019-11-18 1235 }
040942fc50b203 Eugene Zemtsov 2019-11-18 1236 /* Look up a dentry in the .index dir. It should be negative. */Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki