nvmet: type missmatch fixes for nvmet-auth
Subsystems (3)
Chaitanya Kulkarni
maintainercover nvmet: type missmatch fixes for nvmet-auth
Hi,
Couple of type mismatch fixes for nvmet-auth reported by Dan Carpenter.
-ck
Chaitanya Kulkarni (2):
nvmet: fix return value check in auth send
nvmet: fix return value check in auth receive
drivers/nvme/target/fabrics-cmd-auth.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
Signature · 1 line
2.29.0
Chaitanya Kulkarni
maintainerPATCH 1/2 nvmet: fix return value check in auth send
nvmet_setup_auth() return type is int and currently it uses status variable that is of type u16 in nvmet_execute_auth_send().
Catch the return value of nvmet_setup_auth() into int and set the NVME_SC_INTERNAL as status variable before we jump to error.
--- drivers/nvme/target/fabrics-cmd-auth.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/nvme/target/fabrics-cmd-auth.c +4 -2
@@ -247,8 +247,10 @@ void nvmet_execute_auth_send(struct nvmet_req *req)pr_debug ("%s: ctrl %d qid %d reset negotiation\n" , __func__, ctrl->cntlid, req->sq->qid);if (!req->sq->qid) { - status =nvmet_setup_auth (ctrl); -if (status <0 ) { +int ret =nvmet_setup_auth (ctrl); + +if (ret <0 ) { + status =NVME_SC_INTERNAL ;pr_err ("ctrl %d qid 0 failed to setup" "re-authentication" , ctrl->cntlid);
Signature · 1 line
2.29.0
Chaitanya Kulkarni
maintainerPATCH 2/2 nvmet: fix return value check in auth receive
In reply to Chaitanya Kulkarninvmet_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.
--- drivers/nvme/target/fabrics-cmd-auth.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/nvme/target/fabrics-cmd-auth.c +3 -2
@@ -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 ;
Signature · 1 line
2.29.0
Re: [PATCH 1/2] nvmet: fix return value check in auth send
In reply to Chaitanya KulkarniQuoted 19 lines · Chaitanya Kulkarni
nvmet_setup_auth()return type is int and currently it uses status variable that is of type u16 innvmet_execute_auth_send().Catch the return value of
nvmet_setup_auth()into int and set theNVME_SC_INTERNALas status variable before we jump to error.Reported-by Dan Carpenter <[email protected]>Signed-off-by Chaitanya Kulkarni <[email protected]>--- drivers/nvme/target/fabrics-cmd-auth.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/nvme/target/fabrics-cmd-auth.c +0
-0@@ -247,8 +247,10 @@ void nvmet_execute_auth_send(struct nvmet_req *req)pr_debug ("%s: ctrl %d qid %d reset negotiation\n" , __func__, ctrl->cntlid, req->sq->qid);
drivers/nvme/target/fabrics-cmd-auth.c void nvmet_execute_auth_send(struct nvmet_req *req) · line 256
Quoted 10 lines
drivers/nvme/target/fabrics-cmd-auth.c +4
-2if (!req->sq->qid) { - status =nvmet_setup_auth (ctrl); -if (status <0 ) { +int ret =nvmet_setup_auth (ctrl); + +if (ret <0 ) { + status =NVME_SC_INTERNAL ;pr_err ("ctrl %d qid 0 failed to setup" "re-authentication" , ctrl->cntlid);
Cheers,
Hannes
Re: [PATCH 2/2] nvmet: fix return value check in auth receive
In reply to Chaitanya KulkarniQuoted 18 lines · Chaitanya Kulkarni
nvmet_auth_challenge()return type is int and currently it uses status variable that is of type u16 innvmet_execute_auth_receive().Catch the return value of
nvmet_auth_challenge()into int and set theNVME_SC_INTERNALas status variable before we jump to error.Reported-by Dan Carpenter <[email protected]>Signed-off-by Chaitanya Kulkarni <[email protected]>--- drivers/nvme/target/fabrics-cmd-auth.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/nvme/target/fabrics-cmd-auth.c +0
-0@@ -486,8 +486,9 @@ void nvmet_execute_auth_receive(struct nvmet_req *req) ctrl->cntlid, req->sq->qid, req->sq->dhchap_step);
drivers/nvme/target/fabrics-cmd-auth.c void nvmet_execute_auth_receive(struct nvmet_req *req) · line 494
Quoted 10 lines
drivers/nvme/target/fabrics-cmd-auth.c +3
-2switch (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 ;
Cheers,
Hannes
Christoph Hellwig
maintainerRe: [PATCH 1/2] nvmet: fix return value check in auth send
In reply to Chaitanya KulkarniThanks, both patches applied to nvme-5.20.