All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: don.hiatt@intel.com
Cc: linux-rdma@vger.kernel.org, Laura Abbott <labbott@redhat.com>,
	Greg KH <greg@kroah.com>
Subject: [bug report] IB/hfi1: Eliminate allocation while atomic
Date: Wed, 2 Oct 2019 15:15:20 +0300	[thread overview]
Message-ID: <20191002121520.GA11064@mwanda> (raw)

Hello Don Hiatt,

The patch f8195f3b14a0: "IB/hfi1: Eliminate allocation while atomic"
from Oct 9, 2017, leads to the following static checker warning:

	drivers/infiniband/hw/hfi1/verbs.c:824 build_verbs_tx_desc()
	error: doing dma on the stack (trail_buf)

drivers/infiniband/hw/hfi1/verbs.c
   147  /* Length of buffer to create verbs txreq cache name */
   148  #define TXREQ_NAME_LEN 24
   149  
   150  /* 16B trailing buffer */
   151  static const u8 trail_buf[MAX_16B_PADDING];
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^

This used to be actually allocated on the stack but now it's here.  I
believe this is still a problem.  It's not a problem for most people at
runtime, but it's technically a bug.  And I believe that soon we will
add a check in dma_map_single() which will generate a warning.

   152  
   153  static uint wss_threshold = 80;

[ snip ]

   801          } else {
   802                  ret = sdma_txinit_ahg(
   803                          &tx->txreq,
   804                          ahg_info->tx_flags,
   805                          length,
   806                          ahg_info->ahgidx,
   807                          ahg_info->ahgcount,
   808                          ahg_info->ahgdesc,
   809                          hdrbytes,
   810                          verbs_sdma_complete);
   811                  if (ret)
   812                          goto bail_txadd;
   813          }
   814          /* add the ulp payload - if any. tx->ss can be NULL for acks */
   815          if (tx->ss) {
   816                  ret = build_verbs_ulp_payload(sde, length, tx);
   817                  if (ret)
   818                          goto bail_txadd;
   819          }
   820  
   821          /* add icrc, lt byte, and padding to flit */
   822          if (extra_bytes)
   823                  ret = sdma_txadd_kvaddr(sde->dd, &tx->txreq,
   824                                          (void *)trail_buf, extra_bytes);
                                                        ^^^^^^^^^
This has to be DMAable memory.

   825  
   826  bail_txadd:
   827          return ret;
   828  }


regards,
dan carpenter

             reply	other threads:[~2019-10-02 12:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-02 12:15 Dan Carpenter [this message]
2019-10-03 11:58 ` [bug report] IB/hfi1: Eliminate allocation while atomic Dennis Dalessandro
2019-10-04 21:09   ` Marciniszyn, Mike
2019-10-05  5:20     ` Dan Carpenter

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=20191002121520.GA11064@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=don.hiatt@intel.com \
    --cc=greg@kroah.com \
    --cc=labbott@redhat.com \
    --cc=linux-rdma@vger.kernel.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 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.