Re: [PATCH 1/1] sget_dev() bug fix: dev_t passed by value but stored via stack address

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

 



Hi John,

kernel test robot noticed the following build warnings:

[auto build test WARNING on fec50db7033ea478773b159e0e2efb135270e3b7]

url:    https://github.com/intel-lab-lkp/linux/commits/John-Groves/sget_dev-bug-fix-dev_t-passed-by-value-but-stored-via-stack-address/20240410-073305
base:   fec50db7033ea478773b159e0e2efb135270e3b7
patch link:    https://lore.kernel.org/r/7a37d4832e0c2e7cfe8000b0bf47dcc2c50d78d0.1712704849.git.john%40groves.net
patch subject: [PATCH 1/1] sget_dev() bug fix: dev_t passed by value but stored via stack address
config: openrisc-allnoconfig (https://download.01.org/0day-ci/archive/20240410/202404101632.62NM3BlE-lkp@xxxxxxxxx/config)
compiler: or1k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240410/202404101632.62NM3BlE-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202404101632.62NM3BlE-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

   fs/super.c: In function 'set_bdev_super':
>> fs/super.c:1311:21: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    1311 |         u64 devno = (u64)data;
         |                     ^
   fs/super.c: In function 'super_s_dev_test':
   fs/super.c:1324:21: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    1324 |         u64 devno = (u64)fc->sget_key;
         |                     ^
   fs/super.c: In function 'sget_dev':
>> fs/super.c:1354:24: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
    1354 |         fc->sget_key = (void *)devno;
         |                        ^
   fs/super.c: In function 'mount_bdev':
   fs/super.c:1654:67: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
    1654 |         s = sget(fs_type, test_bdev_super, set_bdev_super, flags, (void *)devno);
         |                                                                   ^


vim +1311 fs/super.c

  1308	
  1309	static int set_bdev_super(struct super_block *s, void *data)
  1310	{
> 1311		u64 devno = (u64)data;
  1312	
  1313		s->s_dev = (dev_t)devno;
  1314		return 0;
  1315	}
  1316	
  1317	static int super_s_dev_set(struct super_block *s, struct fs_context *fc)
  1318	{
  1319		return set_bdev_super(s, fc->sget_key);
  1320	}
  1321	
  1322	static int super_s_dev_test(struct super_block *s, struct fs_context *fc)
  1323	{
  1324		u64 devno = (u64)fc->sget_key;
  1325	
  1326		return !(s->s_iflags & SB_I_RETIRED) &&
  1327			s->s_dev == (dev_t)devno;
  1328	}
  1329	
  1330	/**
  1331	 * sget_dev - Find or create a superblock by device number
  1332	 * @fc: Filesystem context.
  1333	 * @dev: device number
  1334	 *
  1335	 * Find or create a superblock using the provided device number that
  1336	 * will be stored in fc->sget_key.
  1337	 *
  1338	 * If an extant superblock is matched, then that will be returned with
  1339	 * an elevated reference count that the caller must transfer or discard.
  1340	 *
  1341	 * If no match is made, a new superblock will be allocated and basic
  1342	 * initialisation will be performed (s_type, s_fs_info, s_id, s_dev will
  1343	 * be set). The superblock will be published and it will be returned in
  1344	 * a partially constructed state with SB_BORN and SB_ACTIVE as yet
  1345	 * unset.
  1346	 *
  1347	 * Return: an existing or newly created superblock on success, an error
  1348	 *         pointer on failure.
  1349	 */
  1350	struct super_block *sget_dev(struct fs_context *fc, dev_t dev)
  1351	{
  1352		u64 devno = (u64)dev;
  1353	
> 1354		fc->sget_key = (void *)devno;
  1355		return sget_fc(fc, super_s_dev_test, super_s_dev_set);
  1356	}
  1357	EXPORT_SYMBOL(sget_dev);
  1358	

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




[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