public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
To: pradeeps-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: re: IPoIB/cm: Add connected mode support for devices without SRQs
Date: Mon, 9 Jan 2012 14:58:40 +0300	[thread overview]
Message-ID: <20120109115840.GA12634@elgon.mountain> (raw)

Hello Pradeep Satyanarayana,

This is a semi-automatic email about new static checker warnings.

The patch 68e995a29572: "IPoIB/cm: Add connected mode support for 
devices without SRQs" from Jan 25, 2008, leads to the following 
Smatch complaint:

drivers/infiniband/ulp/ipoib/ipoib_cm.c +684 ipoib_cm_handle_rx_wc()
	 error: we previously assumed 'p' could be null (see line 611)

drivers/infiniband/ulp/ipoib/ipoib_cm.c
   610		if (unlikely(!(wr_id & IPOIB_CM_RX_UPDATE_MASK))) {
   611			if (p && time_after_eq(jiffies, p->jiffies + IPOIB_CM_RX_UPDATE_TIME)) {
                            ^
Old check.  This was added in d6ef7d68 to fix a NULL deref that people
were hitting in production but the code has been rewritten since then
and I don't know if the check is still needed.

   612				spin_lock_irqsave(&priv->lock, flags);
   613				p->jiffies = jiffies;
   614				/* Move this entry to list head, but do not re-add it
   615				 * if it has been moved out of list. */
   616				if (p->state == IPOIB_CM_RX_LIVE)
   617					list_move(&p->list, &priv->cm.passive_ids);
   618				spin_unlock_irqrestore(&priv->lock, flags);
   619			}
   620		}
   621	
   622		if (wc->byte_len < IPOIB_CM_COPYBREAK) {

[snipped]

   674	repost:
   675		if (has_srq) {
   676			if (unlikely(ipoib_cm_post_receive_srq(dev, wr_id)))
   677				ipoib_warn(priv, "ipoib_cm_post_receive_srq failed "
   678					   "for buf %d\n", wr_id);
   679		} else {
   680			if (unlikely(ipoib_cm_post_receive_nonsrq(dev, p,
   681								  &priv->cm.rx_wr,
   682								  priv->cm.rx_sge,
   683								  wr_id))) {
   684				--p->recv_count;
                                  ^^^
New dereference.

   685				ipoib_warn(priv, "ipoib_cm_post_receive_nonsrq failed "
   686					   "for buf %d\n", wr_id);

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:[~2012-01-09 11:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20120109115840.GA12634@elgon.mountain \
    --to=dan.carpenter-qhclzuegtsvqt0dzr+alfa@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=pradeeps-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@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