From: Dan Carpenter <dan.carpenter@oracle.com>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Mike Christie <michael.christie@oracle.com>,
Himanshu Madhani <himanshu.madhani@oracle.com>,
Roman Bolshakov <r.bolshakov@yadro.com>,
linux-scsi@vger.kernel.org, target-devel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: [PATCH] scsi: target: iscsi: Use strcmp() instead of strncmp()
Date: Thu, 27 Jan 2022 11:47:54 +0300 [thread overview]
Message-ID: <20220127084754.GA25644@kili> (raw)
We want to match the whole string "=All" and this code does that, but
strncmp() is normally used for a partial match and it's more readable
to use strcmp().
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/target/iscsi/iscsi_target.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index 2c54c5d8412d..4534101a7376 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -2213,7 +2213,7 @@ iscsit_process_text_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
/* '=' confirmed in strncmp */
text_ptr = strchr(text_in, '=');
BUG_ON(!text_ptr);
- if (!strncmp("=All", text_ptr, 5)) {
+ if (!strcmp("=All", text_ptr)) {
cmd->cmd_flags |= ICF_SENDTARGETS_ALL;
} else if (!strncmp("=iqn.", text_ptr, 5) ||
!strncmp("=eui.", text_ptr, 5)) {
--
2.20.1
next reply other threads:[~2022-01-27 8:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-27 8:47 Dan Carpenter [this message]
2022-01-30 18:00 ` [PATCH] scsi: target: iscsi: Use strcmp() instead of strncmp() Mark Mielke
2022-02-01 11:58 ` 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=20220127084754.GA25644@kili \
--to=dan.carpenter@oracle.com \
--cc=himanshu.madhani@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=michael.christie@oracle.com \
--cc=r.bolshakov@yadro.com \
--cc=target-devel@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.