public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
To: xushaobo2-hv44wF8Li93QT0dZR+AlfA@public.gmane.org
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [bug report] IB/hns: Fix the bug when free mr
Date: Tue, 14 Mar 2017 16:39:29 +0300	[thread overview]
Message-ID: <20170314133929.GA31861@mwanda> (raw)

Hello Shaobo Xu,

The patch bfcc681bd09d: "IB/hns: Fix the bug when free mr" from Nov
29, 2016, leads to the following static checker warning:

	drivers/infiniband/hw/hns/hns_roce_hw_v1.c:909 hns_roce_v1_recreate_lp_qp()
	error: potential null dereference 'lp_qp_work'.  (kzalloc returns null)

drivers/infiniband/hw/hns/hns_roce_hw_v1.c
   891  static int hns_roce_v1_recreate_lp_qp(struct hns_roce_dev *hr_dev)
   892  {
   893          struct device *dev = &hr_dev->pdev->dev;
   894          struct hns_roce_recreate_lp_qp_work *lp_qp_work;
   895          struct hns_roce_free_mr *free_mr;
   896          struct hns_roce_v1_priv *priv;
   897          struct completion comp;
   898          unsigned long end =
   899            msecs_to_jiffies(HNS_ROCE_V1_RECREATE_LP_QP_TIMEOUT_MSECS) + jiffies;
   900  
   901          priv = (struct hns_roce_v1_priv *)hr_dev->hw->priv;
   902          free_mr = &priv->free_mr;
   903  
   904          lp_qp_work = kzalloc(sizeof(struct hns_roce_recreate_lp_qp_work),
                ^^^^^^^^^^^^^^^^^^^^
Not checked.

   905                               GFP_KERNEL);
   906  
   907          INIT_WORK(&(lp_qp_work->work), hns_roce_v1_recreate_lp_qp_work_fn);
   908  
   909          lp_qp_work->ib_dev = &(hr_dev->ib_dev);
   910          lp_qp_work->comp = &comp;
   911          lp_qp_work->comp_flag = 1;
   912  
   913          init_completion(lp_qp_work->comp);
   914  
   915          queue_work(free_mr->free_mr_wq, &(lp_qp_work->work));
   916  
   917          while (time_before_eq(jiffies, end)) {
   918                  if (try_wait_for_completion(&comp))
   919                          return 0;
   920                  msleep(HNS_ROCE_V1_RECREATE_LP_QP_WAIT_VALUE);
   921          }


regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

             reply	other threads:[~2017-03-14 13:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-14 13:39 Dan Carpenter [this message]
2017-03-15  1:07 ` [bug report] IB/hns: Fix the bug when free mr Shaobo Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170314133929.GA31861@mwanda \
    --to=dan.carpenter-qhclzuegtsvqt0dzr+alfa@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=xushaobo2-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox