* [PATCH 1/2] tcm_qla2xxx: tcm_qla2xxx_handle_tmr() can be static
@ 2012-06-12 1:31 Roland Dreier
2012-06-12 1:31 ` [PATCH 2/2] tcm_qla2xxx: Handle malformed wwn strings properly Roland Dreier
0 siblings, 1 reply; 2+ messages in thread
From: Roland Dreier @ 2012-06-12 1:31 UTC (permalink / raw)
To: Arun Easi, Chad Dupuis, Nicholas A. Bellinger
Cc: target-devel, linux-scsi, Roland Dreier
From: Roland Dreier <roland@purestorage.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
---
drivers/scsi/qla2xxx/tcm_qla2xxx.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
index 436598f..446297a 100644
--- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
+++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
@@ -652,8 +652,8 @@ static int tcm_qla2xxx_handle_data(struct qla_tgt_cmd *cmd)
/*
* Called from qla_target.c:qlt_issue_task_mgmt()
*/
-int tcm_qla2xxx_handle_tmr(struct qla_tgt_mgmt_cmd *mcmd, uint32_t lun,
- uint8_t tmr_func, uint32_t tag)
+static int tcm_qla2xxx_handle_tmr(struct qla_tgt_mgmt_cmd *mcmd, uint32_t lun,
+ uint8_t tmr_func, uint32_t tag)
{
struct qla_tgt_sess *sess = mcmd->sess;
struct se_cmd *se_cmd = &mcmd->se_cmd;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/2] tcm_qla2xxx: Handle malformed wwn strings properly
2012-06-12 1:31 [PATCH 1/2] tcm_qla2xxx: tcm_qla2xxx_handle_tmr() can be static Roland Dreier
@ 2012-06-12 1:31 ` Roland Dreier
0 siblings, 0 replies; 2+ messages in thread
From: Roland Dreier @ 2012-06-12 1:31 UTC (permalink / raw)
To: Arun Easi, Chad Dupuis, Nicholas A. Bellinger
Cc: target-devel, linux-scsi, Roland Dreier
From: Roland Dreier <roland@purestorage.com>
If we make a variable an unsigned int and then expect it to be < 0 on
a bad character, we're going to have a bad time. Fix the tcm_qla2xxx
code to actually notice if hex_to_bin() returns a negative variable.
This was detected by the compiler warning:
scsi/qla2xxx/tcm_qla2xxx.c: In function ‘tcm_qla2xxx_npiv_extract_wwn’:
scsi/qla2xxx/tcm_qla2xxx.c:148:3: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
Signed-off-by: Roland Dreier <roland@purestorage.com>
---
drivers/scsi/qla2xxx/tcm_qla2xxx.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
index 446297a..ccef32b 100644
--- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
+++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
@@ -137,13 +137,15 @@ static char *tcm_qla2xxx_get_fabric_name(void)
*/
static int tcm_qla2xxx_npiv_extract_wwn(const char *ns, u64 *nm)
{
- unsigned int i, j, value;
+ unsigned int i, j;
u8 wwn[8];
memset(wwn, 0, sizeof(wwn));
/* Validate and store the new name */
for (i = 0, j = 0; i < 16; i++) {
+ int value;
+
value = hex_to_bin(*ns++);
if (value >= 0)
j = (j << 4) | value;
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-06-12 1:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-12 1:31 [PATCH 1/2] tcm_qla2xxx: tcm_qla2xxx_handle_tmr() can be static Roland Dreier
2012-06-12 1:31 ` [PATCH 2/2] tcm_qla2xxx: Handle malformed wwn strings properly Roland Dreier
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).