Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jiasheng Jiang <jiasheng@iscas.ac.cn>
To: skashyap@marvell.com, jhasan@marvell.com,
GR-QLogic-Storage-Upstream@marvell.com, jejb@linux.ibm.com,
martin.petersen@oracle.com, linux@armlinux.org.uk
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, Jiasheng Jiang <jiasheng@iscas.ac.cn>
Subject: [PATCH] scsi: qedf: potential dereference of null pointer
Date: Thu, 16 Dec 2021 18:14:49 +0800 [thread overview]
Message-ID: <20211216101449.375953-1-jiasheng@iscas.ac.cn> (raw)
The return value of dma_alloc_coherent() needs to be checked.
To avoid use of null pointer in case of the failure of alloc.
Fixes: 61d8658b4a43 ("scsi: qedf: Add QLogic FastLinQ offload FCoE driver framework.")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
drivers/scsi/qedf/qedf_main.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
index b92570a7c309..309e205a8e70 100644
--- a/drivers/scsi/qedf/qedf_main.c
+++ b/drivers/scsi/qedf/qedf_main.c
@@ -1415,6 +1415,8 @@ static void qedf_upload_connection(struct qedf_ctx *qedf,
*/
term_params = dma_alloc_coherent(&qedf->pdev->dev, QEDF_TERM_BUFF_SIZE,
&term_params_dma, GFP_KERNEL);
+ if (!term_params)
+ return;
QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_CONN, "Uploading connection "
"port_id=%06x.\n", fcport->rdata->ids.port_id);
--
2.25.1
next reply other threads:[~2021-12-16 10:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-16 10:14 Jiasheng Jiang [this message]
2022-01-03 4:58 ` [EXT] " Saurav Kashyap
2022-01-03 17:12 ` Jakub Kicinski
2022-01-04 4:05 ` Saurav Kashyap
2022-01-05 5:20 ` Martin K. Petersen
2022-01-10 22:04 ` Martin K. Petersen
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=20211216101449.375953-1-jiasheng@iscas.ac.cn \
--to=jiasheng@iscas.ac.cn \
--cc=GR-QLogic-Storage-Upstream@marvell.com \
--cc=jejb@linux.ibm.com \
--cc=jhasan@marvell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=martin.petersen@oracle.com \
--cc=netdev@vger.kernel.org \
--cc=skashyap@marvell.com \
--subject='Re: [PATCH] scsi: qedf: potential dereference of null pointer' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).