Re: [PATCH 2/6] shmem: make shmem_get_inode() return ERR_PTR instead of NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

kernel test robot noticed the following build errors:

[auto build test ERROR on linus/master]
[also build test ERROR on v6.3-rc5]
[cannot apply to akpm-mm/mm-everything next-20230403]
[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/cem-kernel-org/shmem-make-shmem_inode_acct_block-return-error/20230403-165022
patch link:    https://lore.kernel.org/r/20230403084759.884681-3-cem%40kernel.org
patch subject: [PATCH 2/6] shmem: make shmem_get_inode() return ERR_PTR instead of NULL
config: arm-randconfig-r033-20230403 (https://download.01.org/0day-ci/archive/20230404/202304041204.sEsaejmQ-lkp@xxxxxxxxx/config)
compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/98aa926ee22a768f6a2dc8b0b897d018fc47497e
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review cem-kernel-org/shmem-make-shmem_inode_acct_block-return-error/20230403-165022
        git checkout 98aa926ee22a768f6a2dc8b0b897d018fc47497e
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Link: https://lore.kernel.org/oe-kbuild-all/202304041204.sEsaejmQ-lkp@xxxxxxxxx/

All error/warnings (new ones prefixed by >>):

   mm/shmem.c: In function '__shmem_file_setup':
>> mm/shmem.c:4260:33: error: passing argument 1 of 'shmem_get_inode' from incompatible pointer type [-Werror=incompatible-pointer-types]
    4260 |         inode = shmem_get_inode(&nop_mnt_idmap, mnt->mnt_sb, NULL,
         |                                 ^~~~~~~~~~~~~~
         |                                 |
         |                                 struct mnt_idmap *
   mm/shmem.c:4231:65: note: expected 'struct super_block *' but argument is of type 'struct mnt_idmap *'
    4231 | static inline struct inode *shmem_get_inode(struct super_block *sb, struct inode *dir,
         |                                             ~~~~~~~~~~~~~~~~~~~~^~
   mm/shmem.c:4260:52: error: passing argument 2 of 'shmem_get_inode' from incompatible pointer type [-Werror=incompatible-pointer-types]
    4260 |         inode = shmem_get_inode(&nop_mnt_idmap, mnt->mnt_sb, NULL,
         |                                                 ~~~^~~~~~~~
         |                                                    |
         |                                                    struct super_block *
   mm/shmem.c:4231:83: note: expected 'struct inode *' but argument is of type 'struct super_block *'
    4231 | static inline struct inode *shmem_get_inode(struct super_block *sb, struct inode *dir,
         |                                                                     ~~~~~~~~~~~~~~^~~
   In file included from include/uapi/linux/posix_types.h:5,
                    from include/uapi/linux/types.h:14,
                    from include/linux/types.h:6,
                    from include/linux/kasan-checks.h:5,
                    from include/asm-generic/rwonce.h:26,
                    from ./arch/arm/include/generated/asm/rwonce.h:1,
                    from include/linux/compiler.h:247,
                    from include/linux/build_bug.h:5,
                    from include/linux/container_of.h:5,
                    from include/linux/list.h:5,
                    from include/linux/wait.h:7,
                    from include/linux/wait_bit.h:8,
                    from include/linux/fs.h:6,
                    from mm/shmem.c:24:
>> include/linux/stddef.h:8:14: warning: passing argument 3 of 'shmem_get_inode' makes integer from pointer without a cast [-Wint-conversion]
       8 | #define NULL ((void *)0)
         |              ^~~~~~~~~~~
         |              |
         |              void *
   mm/shmem.c:4260:62: note: in expansion of macro 'NULL'
    4260 |         inode = shmem_get_inode(&nop_mnt_idmap, mnt->mnt_sb, NULL,
         |                                                              ^~~~
   mm/shmem.c:4232:53: note: expected 'umode_t' {aka 'short unsigned int'} but argument is of type 'void *'
    4232 |                                             umode_t mode, dev_t dev, unsigned long flags)
         |                                             ~~~~~~~~^~~~
>> mm/shmem.c:4260:17: error: too many arguments to function 'shmem_get_inode'
    4260 |         inode = shmem_get_inode(&nop_mnt_idmap, mnt->mnt_sb, NULL,
         |                 ^~~~~~~~~~~~~~~
   mm/shmem.c:4231:29: note: declared here
    4231 | static inline struct inode *shmem_get_inode(struct super_block *sb, struct inode *dir,
         |                             ^~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +/shmem_get_inode +4260 mm/shmem.c

^1da177e4c3f41 Linus Torvalds    2005-04-16  4241  
703321b60b605b Matthew Auld      2017-10-06  4242  static struct file *__shmem_file_setup(struct vfsmount *mnt, const char *name, loff_t size,
c7277090927a5e Eric Paris        2013-12-02  4243  				       unsigned long flags, unsigned int i_flags)
^1da177e4c3f41 Linus Torvalds    2005-04-16  4244  {
^1da177e4c3f41 Linus Torvalds    2005-04-16  4245  	struct inode *inode;
93dec2da7b2349 Al Viro           2018-07-08  4246  	struct file *res;
^1da177e4c3f41 Linus Torvalds    2005-04-16  4247  
703321b60b605b Matthew Auld      2017-10-06  4248  	if (IS_ERR(mnt))
703321b60b605b Matthew Auld      2017-10-06  4249  		return ERR_CAST(mnt);
^1da177e4c3f41 Linus Torvalds    2005-04-16  4250  
285b2c4fdd69ea Hugh Dickins      2011-08-03  4251  	if (size < 0 || size > MAX_LFS_FILESIZE)
^1da177e4c3f41 Linus Torvalds    2005-04-16  4252  		return ERR_PTR(-EINVAL);
^1da177e4c3f41 Linus Torvalds    2005-04-16  4253  
^1da177e4c3f41 Linus Torvalds    2005-04-16  4254  	if (shmem_acct_size(flags, size))
^1da177e4c3f41 Linus Torvalds    2005-04-16  4255  		return ERR_PTR(-ENOMEM);
^1da177e4c3f41 Linus Torvalds    2005-04-16  4256  
7a80e5b8c6fa7d Giuseppe Scrivano 2023-01-20  4257  	if (is_idmapped_mnt(mnt))
7a80e5b8c6fa7d Giuseppe Scrivano 2023-01-20  4258  		return ERR_PTR(-EINVAL);
7a80e5b8c6fa7d Giuseppe Scrivano 2023-01-20  4259  
7a80e5b8c6fa7d Giuseppe Scrivano 2023-01-20 @4260  	inode = shmem_get_inode(&nop_mnt_idmap, mnt->mnt_sb, NULL,
7a80e5b8c6fa7d Giuseppe Scrivano 2023-01-20  4261  				S_IFREG | S_IRWXUGO, 0, flags);
98aa926ee22a76 Lukas Czerner     2023-04-03  4262  
98aa926ee22a76 Lukas Czerner     2023-04-03  4263  	if (IS_ERR(inode)) {
dac2d1f6cbfe3f Al Viro           2018-06-09  4264  		shmem_unacct_size(flags, size);
98aa926ee22a76 Lukas Czerner     2023-04-03  4265  		return ERR_CAST(inode);
dac2d1f6cbfe3f Al Viro           2018-06-09  4266  	}
c7277090927a5e Eric Paris        2013-12-02  4267  	inode->i_flags |= i_flags;
^1da177e4c3f41 Linus Torvalds    2005-04-16  4268  	inode->i_size = size;
6d6b77f163c7ea Miklos Szeredi    2011-10-28  4269  	clear_nlink(inode);	/* It is unlinked */
26567cdbbf1a6b Al Viro           2013-03-01  4270  	res = ERR_PTR(ramfs_nommu_expand_for_mapping(inode, size));
93dec2da7b2349 Al Viro           2018-07-08  4271  	if (!IS_ERR(res))
93dec2da7b2349 Al Viro           2018-07-08  4272  		res = alloc_file_pseudo(inode, mnt, name, O_RDWR,
4b42af81f0d7f9 Al Viro           2009-08-05  4273  				&shmem_file_operations);
6b4d0b2793337c Al Viro           2013-02-14  4274  	if (IS_ERR(res))
93dec2da7b2349 Al Viro           2018-07-08  4275  		iput(inode);
6b4d0b2793337c Al Viro           2013-02-14  4276  	return res;
^1da177e4c3f41 Linus Torvalds    2005-04-16  4277  }
c7277090927a5e Eric Paris        2013-12-02  4278  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux