Re: [PATCH v3] fs/btrfs: Fix uninitialized variable
From: kernel test robot
Date: Tue Apr 20 2021 - 17:05:20 EST
Hi Khaled,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on kdave/for-next]
[also build test WARNING on v5.12-rc8 next-20210420]
[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]
url: https://github.com/0day-ci/linux/commits/Khaled-ROMDHANI/fs-btrfs-Fix-uninitialized-variable/20210420-231754
base: https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git for-next
config: arm-randconfig-r021-20210420 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project ca8eef7e3da8f750d7c7aa004fe426d1d34787ea)
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
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/0day-ci/linux/commit/c05b2a58c9ed11bd753f1e64695bd89da715fbaa
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Khaled-ROMDHANI/fs-btrfs-Fix-uninitialized-variable/20210420-231754
git checkout c05b2a58c9ed11bd753f1e64695bd89da715fbaa
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=arm
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All warnings (new ones prefixed by >>):
>> fs/btrfs/zoned.c:146:2: warning: variable 'zone' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized]
default:
^~~~~~~
fs/btrfs/zoned.c:153:14: note: uninitialized use occurs here
return (u32)zone;
^~~~
fs/btrfs/zoned.c:139:10: note: initialize the variable 'zone' to silence this warning
u64 zone;
^
= 0
1 warning generated.
vim +/zone +146 fs/btrfs/zoned.c
133
134 /*
135 * Get the first zone number of the superblock mirror
136 */
137 static inline u32 sb_zone_number(int shift, int mirror)
138 {
139 u64 zone;
140
141 ASSERT(mirror < BTRFS_SUPER_MIRROR_MAX);
142 switch (mirror) {
143 case 0: zone = 0; break;
144 case 1: zone = 1ULL << (BTRFS_SB_LOG_FIRST_SHIFT - shift); break;
145 case 2: zone = 1ULL << (BTRFS_SB_LOG_SECOND_SHIFT - shift); break;
> 146 default:
147 ASSERT(zone);
148 break;
149 }
150
151 ASSERT(zone <= U32_MAX);
152
153 return (u32)zone;
154 }
155
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip