lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202504102206.gpAU9chA-lkp@intel.com>
Date: Thu, 10 Apr 2025 22:45:03 +0800
From: kernel test robot <lkp@...el.com>
To: Yangtao Li <frank.li@...o.com>, clm@...com, josef@...icpanda.com,
	dsterba@...e.com
Cc: llvm@...ts.linux.dev, oe-kbuild-all@...ts.linux.dev,
	linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org,
	Yangtao Li <frank.li@...o.com>
Subject: Re: [PATCH 2/2] btrfs: convert to mutex guard in
 btrfs_ioctl_balance_progress()

Hi Yangtao,

kernel test robot noticed the following build warnings:

[auto build test WARNING on kdave/for-next]
[also build test WARNING on linus/master v6.15-rc1 next-20250410]
[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/Yangtao-Li/btrfs-convert-to-mutex-guard-in-btrfs_ioctl_balance_progress/20250409-204204
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next
patch link:    https://lore.kernel.org/r/20250409125724.145597-2-frank.li%40vivo.com
patch subject: [PATCH 2/2] btrfs: convert to mutex guard in btrfs_ioctl_balance_progress()
config: arm-randconfig-001-20250410 (https://download.01.org/0day-ci/archive/20250410/202504102206.gpAU9chA-lkp@intel.com/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project f819f46284f2a79790038e1f6649172789734ae8)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250410/202504102206.gpAU9chA-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/202504102206.gpAU9chA-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> fs/btrfs/ioctl.c:3639:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
    3639 |         if (copy_to_user(arg, bargs, sizeof(*bargs)))
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/btrfs/ioctl.c:3644:9: note: uninitialized use occurs here
    3644 |         return ret;
         |                ^~~
   fs/btrfs/ioctl.c:3639:2: note: remove the 'if' if its condition is always true
    3639 |         if (copy_to_user(arg, bargs, sizeof(*bargs)))
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    3640 |                 ret = -EFAULT;
   fs/btrfs/ioctl.c:3623:9: note: initialize the variable 'ret' to silence this warning
    3623 |         int ret;
         |                ^
         |                 = 0
   1 warning generated.


vim +3639 fs/btrfs/ioctl.c

837d5b6e46d1a4 Ilya Dryomov 2012-01-16  3618  
2ff7e61e0d30ff Jeff Mahoney 2016-06-22  3619  static long btrfs_ioctl_balance_progress(struct btrfs_fs_info *fs_info,
19a39dce3b9bf0 Ilya Dryomov 2012-01-16  3620  					 void __user *arg)
19a39dce3b9bf0 Ilya Dryomov 2012-01-16  3621  {
19a39dce3b9bf0 Ilya Dryomov 2012-01-16  3622  	struct btrfs_ioctl_balance_args *bargs;
68395a7bf00486 Yangtao Li   2025-04-09  3623  	int ret;
19a39dce3b9bf0 Ilya Dryomov 2012-01-16  3624  
19a39dce3b9bf0 Ilya Dryomov 2012-01-16  3625  	if (!capable(CAP_SYS_ADMIN))
19a39dce3b9bf0 Ilya Dryomov 2012-01-16  3626  		return -EPERM;
19a39dce3b9bf0 Ilya Dryomov 2012-01-16  3627  
68395a7bf00486 Yangtao Li   2025-04-09  3628  	guard(mutex)(&fs_info->balance_mutex);
68395a7bf00486 Yangtao Li   2025-04-09  3629  
68395a7bf00486 Yangtao Li   2025-04-09  3630  	if (!fs_info->balance_ctl)
68395a7bf00486 Yangtao Li   2025-04-09  3631  		return -ENOTCONN;
19a39dce3b9bf0 Ilya Dryomov 2012-01-16  3632  
8d2db7855e7b65 David Sterba 2015-11-04  3633  	bargs = kzalloc(sizeof(*bargs), GFP_KERNEL);
68395a7bf00486 Yangtao Li   2025-04-09  3634  	if (!bargs)
68395a7bf00486 Yangtao Li   2025-04-09  3635  		return -ENOMEM;
19a39dce3b9bf0 Ilya Dryomov 2012-01-16  3636  
008ef0969dd966 David Sterba 2018-03-21  3637  	btrfs_update_ioctl_balance_args(fs_info, bargs);
19a39dce3b9bf0 Ilya Dryomov 2012-01-16  3638  
19a39dce3b9bf0 Ilya Dryomov 2012-01-16 @3639  	if (copy_to_user(arg, bargs, sizeof(*bargs)))
19a39dce3b9bf0 Ilya Dryomov 2012-01-16  3640  		ret = -EFAULT;
19a39dce3b9bf0 Ilya Dryomov 2012-01-16  3641  
19a39dce3b9bf0 Ilya Dryomov 2012-01-16  3642  	kfree(bargs);
68395a7bf00486 Yangtao Li   2025-04-09  3643  
19a39dce3b9bf0 Ilya Dryomov 2012-01-16  3644  	return ret;
19a39dce3b9bf0 Ilya Dryomov 2012-01-16  3645  }
19a39dce3b9bf0 Ilya Dryomov 2012-01-16  3646  

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ