public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Chaitanya Kulkarni <kch@nvidia.com>
To: <hare@suse.de>
Cc: <linux-nvme@lists.infradead.org>, <hch@lst.de>,
	<sagi@grimberg.me>, Chaitanya Kulkarni <kch@nvidia.com>,
	Dan Carpenter <dan.carpenter@oracle.com>
Subject: [PATCH 2/2] nvmet: fix return value check in auth receive
Date: Mon, 18 Jul 2022 16:12:33 -0700	[thread overview]
Message-ID: <20220718231233.3886-3-kch@nvidia.com> (raw)
In-Reply-To: <20220718231233.3886-1-kch@nvidia.com>

nvmet_auth_challenge() return type is int and currently it uses status
variable that is of type u16 in nvmet_execute_auth_receive().

Catch the return value of nvmet_auth_challenge() into int and set the
NVME_SC_INTERNAL as status variable before we jump to error.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Chaitanya Kulkarni <kch@nvidia.com>
---
 drivers/nvme/target/fabrics-cmd-auth.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/nvme/target/fabrics-cmd-auth.c b/drivers/nvme/target/fabrics-cmd-auth.c
index f1c9c2f51afb..45056e204dde 100644
--- a/drivers/nvme/target/fabrics-cmd-auth.c
+++ b/drivers/nvme/target/fabrics-cmd-auth.c
@@ -486,8 +486,9 @@ void nvmet_execute_auth_receive(struct nvmet_req *req)
 		 ctrl->cntlid, req->sq->qid, req->sq->dhchap_step);
 	switch (req->sq->dhchap_step) {
 	case NVME_AUTH_DHCHAP_MESSAGE_CHALLENGE:
-		status = nvmet_auth_challenge(req, d, al);
-		if (status < 0) {
+		int ret = nvmet_auth_challenge(req, d, al);
+
+		if (ret < 0) {
 			pr_warn("ctrl %d qid %d: challenge error (%d)\n",
 				ctrl->cntlid, req->sq->qid, status);
 			status = NVME_SC_INTERNAL;
-- 
2.29.0



  parent reply	other threads:[~2022-07-18 23:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-18 23:12 [PATCH 0/2] nvmet: type missmatch fixes for nvmet-auth Chaitanya Kulkarni
2022-07-18 23:12 ` [PATCH 1/2] nvmet: fix return value check in auth send Chaitanya Kulkarni
2022-07-19  6:51   ` Hannes Reinecke
2022-07-21  5:41   ` Christoph Hellwig
2022-07-18 23:12 ` Chaitanya Kulkarni [this message]
2022-07-19  6:51   ` [PATCH 2/2] nvmet: fix return value check in auth receive Hannes Reinecke
2022-07-21 22:15 ` [PATCH 0/2] nvmet: type missmatch fixes for nvmet-auth Sagi Grimberg

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=20220718231233.3886-3-kch@nvidia.com \
    --to=kch@nvidia.com \
    --cc=dan.carpenter@oracle.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    /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