* [leon-rdma:rdma-next 55/57] drivers/infiniband/core/uverbs_cmd.c:799:6: warning: variable 'pd' is used uninitialized whenever 'if' condition is false
@ 2020-07-19 12:45 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2020-07-19 12:45 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 8131 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git rdma-next
head: 0757f2af90704cd86cbc7d1f98a5af5a1d9f38b1
commit: 5315266b49aa1483481880854ff075a79053f477 [55/57] RDMA/uverbs: Remove redundant assignments
config: riscv-randconfig-r012-20200719 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project ed6b578040a85977026c93bf4188f996148f3218)
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
git checkout 5315266b49aa1483481880854ff075a79053f477
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross 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/infiniband/core/uverbs_cmd.c:799:6: warning: variable 'pd' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (cmd.flags & IB_MR_REREG_PD) {
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/infiniband/core/uverbs_cmd.c:811:28: note: uninitialized use occurs here
cmd.access_flags, pd,
^~
drivers/infiniband/core/uverbs_cmd.c:799:2: note: remove the 'if' if its condition is always true
if (cmd.flags & IB_MR_REREG_PD) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/infiniband/core/uverbs_cmd.c:764:18: note: initialize the variable 'pd' to silence this warning
struct ib_pd *pd;
^
= NULL
1 warning generated.
vim +799 drivers/infiniband/core/uverbs_cmd.c
bc38a6abdd5a50 Roland Dreier 2005-07-07 759
974d6b4b2bc33c Jason Gunthorpe 2018-11-25 760 static int ib_uverbs_rereg_mr(struct uverbs_attr_bundle *attrs)
7e6edb9b2e0bcf Matan Barak 2014-07-31 761 {
7e6edb9b2e0bcf Matan Barak 2014-07-31 762 struct ib_uverbs_rereg_mr cmd;
7e6edb9b2e0bcf Matan Barak 2014-07-31 763 struct ib_uverbs_rereg_mr_resp resp;
5315266b49aa14 Leon Romanovsky 2020-07-19 764 struct ib_pd *pd;
7e6edb9b2e0bcf Matan Barak 2014-07-31 765 struct ib_mr *mr;
7e6edb9b2e0bcf Matan Barak 2014-07-31 766 struct ib_pd *old_pd;
7e6edb9b2e0bcf Matan Barak 2014-07-31 767 int ret;
7e6edb9b2e0bcf Matan Barak 2014-07-31 768 struct ib_uobject *uobj;
7e6edb9b2e0bcf Matan Barak 2014-07-31 769
3c2c20947ddbb8 Jason Gunthorpe 2018-11-25 770 ret = uverbs_request(attrs, &cmd, sizeof(cmd));
3c2c20947ddbb8 Jason Gunthorpe 2018-11-25 771 if (ret)
3c2c20947ddbb8 Jason Gunthorpe 2018-11-25 772 return ret;
7e6edb9b2e0bcf Matan Barak 2014-07-31 773
7e6edb9b2e0bcf Matan Barak 2014-07-31 774 if (cmd.flags & ~IB_MR_REREG_SUPPORTED || !cmd.flags)
7e6edb9b2e0bcf Matan Barak 2014-07-31 775 return -EINVAL;
7e6edb9b2e0bcf Matan Barak 2014-07-31 776
7e6edb9b2e0bcf Matan Barak 2014-07-31 777 if ((cmd.flags & IB_MR_REREG_TRANS) &&
7e6edb9b2e0bcf Matan Barak 2014-07-31 778 (!cmd.start || !cmd.hca_va || 0 >= cmd.length ||
7e6edb9b2e0bcf Matan Barak 2014-07-31 779 (cmd.start & ~PAGE_MASK) != (cmd.hca_va & ~PAGE_MASK)))
7e6edb9b2e0bcf Matan Barak 2014-07-31 780 return -EINVAL;
7e6edb9b2e0bcf Matan Barak 2014-07-31 781
8313c10fa8be03 Jason Gunthorpe 2018-11-25 782 uobj = uobj_get_write(UVERBS_OBJECT_MR, cmd.mr_handle, attrs);
fd3c7904db6e05 Matan Barak 2017-04-04 783 if (IS_ERR(uobj))
fd3c7904db6e05 Matan Barak 2017-04-04 784 return PTR_ERR(uobj);
7e6edb9b2e0bcf Matan Barak 2014-07-31 785
7e6edb9b2e0bcf Matan Barak 2014-07-31 786 mr = uobj->object;
7e6edb9b2e0bcf Matan Barak 2014-07-31 787
5ccbf63f87a39c Ariel Levkovich 2018-04-26 788 if (mr->dm) {
5ccbf63f87a39c Ariel Levkovich 2018-04-26 789 ret = -EINVAL;
5ccbf63f87a39c Ariel Levkovich 2018-04-26 790 goto put_uobjs;
5ccbf63f87a39c Ariel Levkovich 2018-04-26 791 }
5ccbf63f87a39c Ariel Levkovich 2018-04-26 792
7e6edb9b2e0bcf Matan Barak 2014-07-31 793 if (cmd.flags & IB_MR_REREG_ACCESS) {
7e6edb9b2e0bcf Matan Barak 2014-07-31 794 ret = ib_check_mr_access(cmd.access_flags);
7e6edb9b2e0bcf Matan Barak 2014-07-31 795 if (ret)
7e6edb9b2e0bcf Matan Barak 2014-07-31 796 goto put_uobjs;
7e6edb9b2e0bcf Matan Barak 2014-07-31 797 }
7e6edb9b2e0bcf Matan Barak 2014-07-31 798
7e6edb9b2e0bcf Matan Barak 2014-07-31 @799 if (cmd.flags & IB_MR_REREG_PD) {
2cc1e3b80942a7 Jason Gunthorpe 2018-07-04 800 pd = uobj_get_obj_read(pd, UVERBS_OBJECT_PD, cmd.pd_handle,
8313c10fa8be03 Jason Gunthorpe 2018-11-25 801 attrs);
7e6edb9b2e0bcf Matan Barak 2014-07-31 802 if (!pd) {
7e6edb9b2e0bcf Matan Barak 2014-07-31 803 ret = -EINVAL;
7e6edb9b2e0bcf Matan Barak 2014-07-31 804 goto put_uobjs;
7e6edb9b2e0bcf Matan Barak 2014-07-31 805 }
7e6edb9b2e0bcf Matan Barak 2014-07-31 806 }
7e6edb9b2e0bcf Matan Barak 2014-07-31 807
25fd08eb2be0fc Leon Romanovsky 2019-02-21 808 old_pd = mr->pd;
3023a1e93656c0 Kamal Heib 2018-12-10 809 ret = mr->device->ops.rereg_user_mr(mr, cmd.flags, cmd.start,
3023a1e93656c0 Kamal Heib 2018-12-10 810 cmd.length, cmd.hca_va,
3023a1e93656c0 Kamal Heib 2018-12-10 811 cmd.access_flags, pd,
ef87df2c7a8f04 Jason Gunthorpe 2018-11-25 812 &attrs->driver_udata);
e278173fd19eb5 Yuval Shaia 2019-02-18 813 if (ret)
e278173fd19eb5 Yuval Shaia 2019-02-18 814 goto put_uobj_pd;
e278173fd19eb5 Yuval Shaia 2019-02-18 815
7e6edb9b2e0bcf Matan Barak 2014-07-31 816 if (cmd.flags & IB_MR_REREG_PD) {
7e6edb9b2e0bcf Matan Barak 2014-07-31 817 atomic_inc(&pd->usecnt);
7e6edb9b2e0bcf Matan Barak 2014-07-31 818 mr->pd = pd;
7e6edb9b2e0bcf Matan Barak 2014-07-31 819 atomic_dec(&old_pd->usecnt);
7e6edb9b2e0bcf Matan Barak 2014-07-31 820 }
7e6edb9b2e0bcf Matan Barak 2014-07-31 821
04c0a5fcfcf65a Yishai Hadas 2020-06-30 822 if (cmd.flags & IB_MR_REREG_TRANS)
04c0a5fcfcf65a Yishai Hadas 2020-06-30 823 mr->iova = cmd.hca_va;
04c0a5fcfcf65a Yishai Hadas 2020-06-30 824
7e6edb9b2e0bcf Matan Barak 2014-07-31 825 memset(&resp, 0, sizeof(resp));
7e6edb9b2e0bcf Matan Barak 2014-07-31 826 resp.lkey = mr->lkey;
7e6edb9b2e0bcf Matan Barak 2014-07-31 827 resp.rkey = mr->rkey;
7e6edb9b2e0bcf Matan Barak 2014-07-31 828
9a0738575f2691 Jason Gunthorpe 2018-11-25 829 ret = uverbs_response(attrs, &resp, sizeof(resp));
7e6edb9b2e0bcf Matan Barak 2014-07-31 830
7e6edb9b2e0bcf Matan Barak 2014-07-31 831 put_uobj_pd:
7e6edb9b2e0bcf Matan Barak 2014-07-31 832 if (cmd.flags & IB_MR_REREG_PD)
fd3c7904db6e05 Matan Barak 2017-04-04 833 uobj_put_obj_read(pd);
7e6edb9b2e0bcf Matan Barak 2014-07-31 834
7e6edb9b2e0bcf Matan Barak 2014-07-31 835 put_uobjs:
fd3c7904db6e05 Matan Barak 2017-04-04 836 uobj_put_write(uobj);
7e6edb9b2e0bcf Matan Barak 2014-07-31 837
7e6edb9b2e0bcf Matan Barak 2014-07-31 838 return ret;
7e6edb9b2e0bcf Matan Barak 2014-07-31 839 }
7e6edb9b2e0bcf Matan Barak 2014-07-31 840
:::::: The code at line 799 was first introduced by commit
:::::: 7e6edb9b2e0bcfb2a588db390c44d120213c57ae IB/core: Add user MR re-registration support
:::::: TO: Matan Barak <matanb@mellanox.com>
:::::: CC: Roland Dreier <roland@purestorage.com>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 38483 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-07-19 12:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-19 12:45 [leon-rdma:rdma-next 55/57] drivers/infiniband/core/uverbs_cmd.c:799:6: warning: variable 'pd' is used uninitialized whenever 'if' condition is false kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.