[bug report] IB/mlx5: Skip non-ODP MR when handling a page fault

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Artemy Kovalyov,

The patch 4d5422a309de: "IB/mlx5: Skip non-ODP MR when handling a
page fault" from Nov 25, 2018, leads to the following static checker
warning:

	drivers/infiniband/hw/mlx5/odp.c:825 pagefault_single_data_segment()
	error: uninitialized symbol 'ret'.

drivers/infiniband/hw/mlx5/odp.c
   687  static int pagefault_single_data_segment(struct mlx5_ib_dev *dev,
   688                                           u32 key, u64 io_virt, size_t bcnt,
   689                                           u32 *bytes_committed,
   690                                           u32 *bytes_mapped)
   691  {
   692          int npages = 0, srcu_key, ret, i, outlen, cur_outlen = 0, depth = 0;
   693          struct pf_frame *head = NULL, *frame;
   694          struct mlx5_core_mkey *mmkey;
   695          struct mlx5_ib_mw *mw;
   696          struct mlx5_ib_mr *mr;
   697          struct mlx5_klm *pklm;
   698          u32 *out = NULL;
   699          size_t offset;
   700  
   701          srcu_key = srcu_read_lock(&dev->mr_srcu);
   702  
   703          io_virt += *bytes_committed;
   704          bcnt -= *bytes_committed;
   705  
   706  next_mr:
   707          mmkey = __mlx5_mr_lookup(dev->mdev, mlx5_base_mkey(key));
   708          if (!mmkey || mmkey->key != key) {
   709                  mlx5_ib_dbg(dev, "failed to find mkey %x\n", key);
   710                  ret = -EFAULT;
   711                  goto srcu_unlock;
   712          }
   713  
   714          switch (mmkey->type) {
   715          case MLX5_MKEY_MR:
   716                  mr = container_of(mmkey, struct mlx5_ib_mr, mmkey);
   717                  if (!mr->live || !mr->ibmr.pd) {
   718                          mlx5_ib_dbg(dev, "got dead MR\n");
   719                          ret = -EFAULT;
   720                          goto srcu_unlock;
   721                  }
   722  
   723                  if (!mr->umem->is_odp) {
   724                          mlx5_ib_dbg(dev, "skipping non ODP MR (lkey=0x%06x) in page fault handler.\n",
   725                                      key);
   726                          if (bytes_mapped)
   727                                  *bytes_mapped += bcnt;
   728                          goto srcu_unlock;
                                ^^^^^^^^^^^^^^^^
We should set "ret = 0;" on this path?

   729                  }

[ snip]

   815  srcu_unlock:
   816          while (head) {
   817                  frame = head;
   818                  head = frame->next;
   819                  kfree(frame);
   820          }
   821          kfree(out);
   822  
   823          srcu_read_unlock(&dev->mr_srcu, srcu_key);
   824          *bytes_committed = 0;
   825          return ret ? ret : npages;
                       ^^^
   826  }

regards,
dan carpenter



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux