* [leon-rdma:rdma-next 58/59] drivers/infiniband/core/uverbs_cmd.c:820:6: warning: variable 'new_mr' is used uninitialized whenever 'if' condition is true
@ 2020-11-04 16:33 kernel test robot
2020-11-05 8:22 ` Leon Romanovsky
0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2020-11-04 16:33 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 7755 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git rdma-next
head: e0a81838e0d3c558bfd2776fd6630470c4bdee0e
commit: ce258f66e947591682a30f874692a72381dbfaf0 [58/59] RDMA/uverbs: Allow drivers to create a new HW object during rereg_mr
config: x86_64-randconfig-a003-20201104 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project a6d15d40701ad38f29e4ff93703b3ffa7b204611)
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 x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git/commit/?id=ce258f66e947591682a30f874692a72381dbfaf0
git remote add leon-rdma https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git
git fetch --no-tags leon-rdma rdma-next
git checkout ce258f66e947591682a30f874692a72381dbfaf0
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
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:820:6: warning: variable 'new_mr' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (IS_ERR(new_uobj)) {
^~~~~~~~~~~~~~~~
drivers/infiniband/core/uverbs_cmd.c:879:12: note: uninitialized use occurs here
if (mr == new_mr)
^~~~~~
drivers/infiniband/core/uverbs_cmd.c:820:2: note: remove the 'if' if its condition is always false
if (IS_ERR(new_uobj)) {
^~~~~~~~~~~~~~~~~~~~~~~
drivers/infiniband/core/uverbs_cmd.c:807:7: warning: variable 'new_mr' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (!pd) {
^~~
drivers/infiniband/core/uverbs_cmd.c:879:12: note: uninitialized use occurs here
if (mr == new_mr)
^~~~~~
drivers/infiniband/core/uverbs_cmd.c:807:3: note: remove the 'if' if its condition is always false
if (!pd) {
^~~~~~~~~~
drivers/infiniband/core/uverbs_cmd.c:800:7: warning: variable 'new_mr' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (ret)
^~~
drivers/infiniband/core/uverbs_cmd.c:879:12: note: uninitialized use occurs here
if (mr == new_mr)
^~~~~~
drivers/infiniband/core/uverbs_cmd.c:800:3: note: remove the 'if' if its condition is always false
if (ret)
^~~~~~~~
drivers/infiniband/core/uverbs_cmd.c:793:6: warning: variable 'new_mr' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
if (mr->dm) {
^~~~~~
drivers/infiniband/core/uverbs_cmd.c:879:12: note: uninitialized use occurs here
if (mr == new_mr)
^~~~~~
drivers/infiniband/core/uverbs_cmd.c:793:2: note: remove the 'if' if its condition is always false
if (mr->dm) {
^~~~~~~~~~~~~
drivers/infiniband/core/uverbs_cmd.c:771:22: note: initialize the variable 'new_mr' to silence this warning
struct ib_mr *new_mr;
^
= NULL
4 warnings generated.
vim +820 drivers/infiniband/core/uverbs_cmd.c
760
761 static int ib_uverbs_rereg_mr(struct uverbs_attr_bundle *attrs)
762 {
763 struct ib_uverbs_rereg_mr cmd;
764 struct ib_uverbs_rereg_mr_resp resp;
765 struct ib_pd *pd;
766 struct ib_mr *mr;
767 int ret;
768 struct ib_uobject *uobj;
769 struct ib_uobject *new_uobj;
770 struct ib_device *ib_dev;
771 struct ib_mr *new_mr;
772
773 ret = uverbs_request(attrs, &cmd, sizeof(cmd));
774 if (ret)
775 return ret;
776
777 if (!cmd.flags)
778 return -EINVAL;
779
780 if (cmd.flags & ~IB_MR_REREG_SUPPORTED)
781 return -EOPNOTSUPP;
782
783 if ((cmd.flags & IB_MR_REREG_TRANS) &&
784 (cmd.start & ~PAGE_MASK) != (cmd.hca_va & ~PAGE_MASK))
785 return -EINVAL;
786
787 uobj = uobj_get_write(UVERBS_OBJECT_MR, cmd.mr_handle, attrs);
788 if (IS_ERR(uobj))
789 return PTR_ERR(uobj);
790
791 mr = uobj->object;
792
793 if (mr->dm) {
794 ret = -EINVAL;
795 goto put_uobjs;
796 }
797
798 if (cmd.flags & IB_MR_REREG_ACCESS) {
799 ret = ib_check_mr_access(mr->device, cmd.access_flags);
800 if (ret)
801 goto put_uobjs;
802 }
803
804 if (cmd.flags & IB_MR_REREG_PD) {
805 pd = uobj_get_obj_read(pd, UVERBS_OBJECT_PD, cmd.pd_handle,
806 attrs);
807 if (!pd) {
808 ret = -EINVAL;
809 goto put_uobjs;
810 }
811 } else {
812 pd = mr->pd;
813 }
814
815 /*
816 * The driver might create a new HW object as part of the rereg, we need
817 * to have a uobject ready to hold it.
818 */
819 new_uobj = uobj_alloc(UVERBS_OBJECT_MR, attrs, &ib_dev);
> 820 if (IS_ERR(new_uobj)) {
821 ret = PTR_ERR(new_uobj);
822 goto put_uobj_pd;
823 }
824
825 new_mr = ib_dev->ops.rereg_user_mr(mr, cmd.flags, cmd.start, cmd.length,
826 cmd.hca_va, cmd.access_flags, pd,
827 &attrs->driver_udata);
828 if (IS_ERR(new_mr)) {
829 ret = PTR_ERR(new_mr);
830 goto put_new_uobj;
831 }
832 if (new_mr) {
833 new_mr->device = pd->device;
834 new_mr->pd = pd;
835 new_mr->type = IB_MR_TYPE_USER;
836 new_mr->dm = NULL;
837 new_mr->sig_attrs = NULL;
838 new_mr->uobject = uobj;
839 atomic_inc(&pd->usecnt);
840 new_mr->iova = cmd.hca_va;
841 new_uobj->object = new_mr;
842
843 rdma_restrack_new(&new_mr->res, RDMA_RESTRACK_MR);
844 rdma_restrack_set_name(&new_mr->res, NULL);
845 rdma_restrack_add(&new_mr->res);
846
847 /*
848 * The new uobj for the new HW object is put into the same spot
849 * in the IDR and the old uobj & HW object is deleted.
850 */
851 rdma_assign_uobject(uobj, new_uobj, attrs);
852 rdma_alloc_commit_uobject(new_uobj, attrs);
853 new_uobj = NULL;
854 mr = new_mr;
855 } else {
856 if (mr->pd != pd) {
857 atomic_dec(&mr->pd->usecnt);
858 mr->pd = pd;
859 atomic_inc(&pd->usecnt);
860 }
861 if (cmd.flags & IB_MR_REREG_TRANS)
862 mr->iova = cmd.hca_va;
863 }
864
865 memset(&resp, 0, sizeof(resp));
866 resp.lkey = mr->lkey;
867 resp.rkey = mr->rkey;
868
869 ret = uverbs_response(attrs, &resp, sizeof(resp));
870
871 put_new_uobj:
872 if (new_uobj)
873 uobj_alloc_abort(new_uobj, attrs);
874 put_uobj_pd:
875 if (cmd.flags & IB_MR_REREG_PD)
876 uobj_put_obj_read(pd);
877
878 put_uobjs:
879 if (mr == new_mr)
880 uobj_put_destroy(uobj);
881 else
882 uobj_put_write(uobj);
883
884 return ret;
885 }
886
---
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: 37923 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [leon-rdma:rdma-next 58/59] drivers/infiniband/core/uverbs_cmd.c:820:6: warning: variable 'new_mr' is used uninitialized whenever 'if' condition is true
2020-11-04 16:33 [leon-rdma:rdma-next 58/59] drivers/infiniband/core/uverbs_cmd.c:820:6: warning: variable 'new_mr' is used uninitialized whenever 'if' condition is true kernel test robot
@ 2020-11-05 8:22 ` Leon Romanovsky
0 siblings, 0 replies; 2+ messages in thread
From: Leon Romanovsky @ 2020-11-05 8:22 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 2079 bytes --]
On Thu, Nov 05, 2020 at 12:33:39AM +0800, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git rdma-next
> head: e0a81838e0d3c558bfd2776fd6630470c4bdee0e
> commit: ce258f66e947591682a30f874692a72381dbfaf0 [58/59] RDMA/uverbs: Allow drivers to create a new HW object during rereg_mr
> config: x86_64-randconfig-a003-20201104 (attached as .config)
> compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project a6d15d40701ad38f29e4ff93703b3ffa7b204611)
> 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 x86_64 cross compiling tool for clang build
> # apt-get install binutils-x86-64-linux-gnu
> # https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git/commit/?id=ce258f66e947591682a30f874692a72381dbfaf0
> git remote add leon-rdma https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git
> git fetch --no-tags leon-rdma rdma-next
> git checkout ce258f66e947591682a30f874692a72381dbfaf0
> # save the attached .config to linux build tree
> COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
>
> 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 >>):
Thanks
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index bea1a1aeea22..cfdf89dd92b2 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -766,9 +766,9 @@ static int ib_uverbs_rereg_mr(struct uverbs_attr_bundle *attrs)
struct ib_mr *mr;
int ret;
struct ib_uobject *uobj;
+ struct ib_mr *new_mr = NULL;
struct ib_uobject *new_uobj;
struct ib_device *ib_dev;
- struct ib_mr *new_mr;
ret = uverbs_request(attrs, &cmd, sizeof(cmd));
if (ret)
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-11-05 8:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-04 16:33 [leon-rdma:rdma-next 58/59] drivers/infiniband/core/uverbs_cmd.c:820:6: warning: variable 'new_mr' is used uninitialized whenever 'if' condition is true kernel test robot
2020-11-05 8:22 ` Leon Romanovsky
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.