Messages in this thread | | | Date | Fri, 1 Oct 2021 13:13:16 +0800 | From | kernel test robot <> | Subject | [luxis1999-dev-iommu:dev-iommu-5.14-rfcv1 11/20] drivers/iommu/iommufd/iommufd.c:205:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false |
| |
tree: https://github.com/luxis1999/dev-iommu dev-iommu-5.14-rfcv1 head: 8d2f14a235e67092365d15107cfc357e86d69629 commit: 2be7ba5547b46f6a0629995df75601f6552c40d1 [11/20] iommu/iommufd: Add IOMMU_IOASID_ALLOC/FREE config: riscv-randconfig-r042-20211001 (attached as .config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 962e503cc8bc411f7523cc393acae8aae425b1c4) 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 riscv cross compiling tool for clang build # apt-get install binutils-riscv64-linux-gnu # https://github.com/luxis1999/dev-iommu/commit/2be7ba5547b46f6a0629995df75601f6552c40d1 git remote add luxis1999-dev-iommu https://github.com/luxis1999/dev-iommu git fetch --no-tags luxis1999-dev-iommu dev-iommu-5.14-rfcv1 git checkout 2be7ba5547b46f6a0629995df75601f6552c40d1 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=riscv
If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/iommu/iommufd/iommufd.c:205:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] if (refcount_read(&ioas->refs) > 1) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/iommu/iommufd/iommufd.c:213:9: note: uninitialized use occurs here return ret; ^~~ drivers/iommu/iommufd/iommufd.c:205:2: note: remove the 'if' if its condition is always true if (refcount_read(&ioas->refs) > 1) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/iommu/iommufd/iommufd.c:189:17: note: initialize the variable 'ret' to silence this warning int ioasid, ret; ^ = 0 drivers/iommu/iommufd/iommufd.c:369:7: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (idev->dev == dev || idev->dev_cookie == dev_cookie) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/iommu/iommufd/iommufd.c:409:17: note: uninitialized use occurs here return ERR_PTR(ret); ^~~ drivers/iommu/iommufd/iommufd.c:369:3: note: remove the 'if' if its condition is always false if (idev->dev == dev || idev->dev_cookie == dev_cookie) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/iommu/iommufd/iommufd.c:369:7: warning: variable 'ret' is used uninitialized whenever '||' condition is true [-Wsometimes-uninitialized] if (idev->dev == dev || idev->dev_cookie == dev_cookie) { ^~~~~~~~~~~~~~~~ drivers/iommu/iommufd/iommufd.c:409:17: note: uninitialized use occurs here return ERR_PTR(ret); ^~~ drivers/iommu/iommufd/iommufd.c:369:7: note: remove the '||' if its condition is always false if (idev->dev == dev || idev->dev_cookie == dev_cookie) { ^~~~~~~~~~~~~~~~~~~ drivers/iommu/iommufd/iommufd.c:359:9: note: initialize the variable 'ret' to silence this warning int ret; ^ = 0 3 warnings generated.
vim +205 drivers/iommu/iommufd/iommufd.c
185 186 static int iommufd_ioasid_free(struct iommufd_ctx *ictx, unsigned long arg) 187 { 188 struct iommufd_ioas *ioas = NULL; 189 int ioasid, ret; 190 191 if (copy_from_user(&ioasid, (void __user *)arg, sizeof(ioasid))) 192 return -EFAULT; 193 194 if (ioasid < 0) 195 return -EINVAL; 196 197 mutex_lock(&ictx->lock); 198 ioas = xa_load(&ictx->ioasid_xa, ioasid); 199 if (IS_ERR(ioas)) { 200 ret = -EINVAL; 201 goto out_unlock; 202 } 203 204 /* Disallow free if refcount is not 1 */ > 205 if (refcount_read(&ioas->refs) > 1) { 206 ret = -EBUSY; 207 goto out_unlock; 208 } 209 210 ioas_put_locked(ioas); 211 out_unlock: 212 mutex_unlock(&ictx->lock); 213 return ret; 214 }; 215
--- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org [unhandled content-type:application/gzip] | |