All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Marciniszyn <mike.marciniszyn@intel.com>
To: jgg@ziepe.ca, dledford@redhat.com
Cc: linux-rdma@vger.kernel.org
Subject: [PATCH 1/6] IB/hfi1: Check for error on call to alloc_rsm_map_table
Date: Mon, 15 Jul 2019 12:45:21 -0400	[thread overview]
Message-ID: <20190715164521.74174.27047.stgit@awfm-01.aw.intel.com> (raw)
In-Reply-To: <20190715164423.74174.4994.stgit@awfm-01.aw.intel.com>

From: John Fleck <john.fleck@intel.com>

The call to alloc_rsm_map_table does not check if the kmalloc fails.
Check for a NULL on alloc, and bail if it fails.

Fixes: 372cc85a13c9 ("IB/hfi1: Extract RSM map table init from QOS")
Cc: <stable@vger.kernel.org>
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: John Fleck <john.fleck@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
---
 drivers/infiniband/hw/hfi1/chip.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/hfi1/chip.c b/drivers/infiniband/hw/hfi1/chip.c
index d5b643a..67052dc 100644
--- a/drivers/infiniband/hw/hfi1/chip.c
+++ b/drivers/infiniband/hw/hfi1/chip.c
@@ -14452,7 +14452,7 @@ void hfi1_deinit_vnic_rsm(struct hfi1_devdata *dd)
 		clear_rcvctrl(dd, RCV_CTRL_RCV_RSM_ENABLE_SMASK);
 }
 
-static void init_rxe(struct hfi1_devdata *dd)
+static int init_rxe(struct hfi1_devdata *dd)
 {
 	struct rsm_map_table *rmt;
 	u64 val;
@@ -14461,6 +14461,9 @@ static void init_rxe(struct hfi1_devdata *dd)
 	write_csr(dd, RCV_ERR_MASK, ~0ull);
 
 	rmt = alloc_rsm_map_table(dd);
+	if (!rmt)
+		return -ENOMEM;
+
 	/* set up QOS, including the QPN map table */
 	init_qos(dd, rmt);
 	init_fecn_handling(dd, rmt);
@@ -14487,6 +14490,7 @@ static void init_rxe(struct hfi1_devdata *dd)
 	val |= ((4ull & RCV_BYPASS_HDR_SIZE_MASK) <<
 		RCV_BYPASS_HDR_SIZE_SHIFT);
 	write_csr(dd, RCV_BYPASS, val);
+	return 0;
 }
 
 static void init_other(struct hfi1_devdata *dd)
@@ -15024,7 +15028,10 @@ int hfi1_init_dd(struct hfi1_devdata *dd)
 		goto bail_cleanup;
 
 	/* set initial RXE CSRs */
-	init_rxe(dd);
+	ret = init_rxe(dd);
+	if (ret)
+		goto bail_cleanup;
+
 	/* set initial TXE CSRs */
 	init_txe(dd);
 	/* set initial non-RXE, non-TXE CSRs */


  reply	other threads:[~2019-07-15 16:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-15 16:45 [PATCH 0/6] More 5.3 patches Mike Marciniszyn
2019-07-15 16:45 ` Mike Marciniszyn [this message]
2019-07-15 16:45 ` [PATCH 2/6] IB/hfi1: Unreserve a flushed OPFN request Mike Marciniszyn
2019-07-15 16:45 ` [PATCH 3/6] IB/hfi1: Field not zero-ed when allocating TID flow memory Mike Marciniszyn
2019-07-15 16:45 ` [PATCH 4/6] IB/hfi1: Drop all TID RDMA READ RESP packets after r_next_psn Mike Marciniszyn
2019-07-15 16:45 ` [PATCH 5/6] IB/hfi1: Do not update hcrc for a KDETH packet during fault injection Mike Marciniszyn
2019-07-15 16:45 ` [PATCH 6/6] IB/hfi1: Remove unused define Mike Marciniszyn
2019-07-15 17:54 ` [PATCH 0/6] More 5.3 patches Jason Gunthorpe
2019-07-15 17:55   ` Marciniszyn, Mike
2019-07-15 18:04     ` Jason Gunthorpe
2019-07-15 18:05       ` Marciniszyn, Mike
2019-07-22 18:03 ` Jason Gunthorpe

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=20190715164521.74174.27047.stgit@awfm-01.aw.intel.com \
    --to=mike.marciniszyn@intel.com \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --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.