Skip to content

Commit 5fc136f

Browse files
Merge patch series "qla2xxx klocwork fixes"
Nilesh Javali <[email protected]> says: Please apply the qla2xxx driver klocwork fixes to the scsi tree at your earliest convenience. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
2 parents 51031cc + 991e7ac commit 5fc136f

File tree

7 files changed

+19
-8
lines changed

7 files changed

+19
-8
lines changed

drivers/scsi/qla2xxx/qla_bsg.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,10 @@ qla2x00_process_els(struct bsg_job *bsg_job)
283283

284284
if (bsg_request->msgcode == FC_BSG_RPT_ELS) {
285285
rport = fc_bsg_to_rport(bsg_job);
286+
if (!rport) {
287+
rval = -ENOMEM;
288+
goto done;
289+
}
286290
fcport = *(fc_port_t **) rport->dd_data;
287291
host = rport_to_shost(rport);
288292
vha = shost_priv(host);
@@ -2992,6 +2996,8 @@ qla24xx_bsg_request(struct bsg_job *bsg_job)
29922996

29932997
if (bsg_request->msgcode == FC_BSG_RPT_ELS) {
29942998
rport = fc_bsg_to_rport(bsg_job);
2999+
if (!rport)
3000+
return ret;
29953001
host = rport_to_shost(rport);
29963002
vha = shost_priv(host);
29973003
} else {

drivers/scsi/qla2xxx/qla_edif.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2361,8 +2361,8 @@ qla24xx_issue_sa_replace_iocb(scsi_qla_host_t *vha, struct qla_work_evt *e)
23612361
if (!sa_ctl) {
23622362
ql_dbg(ql_dbg_edif, vha, 0x70e6,
23632363
"sa_ctl allocation failed\n");
2364-
rval = -ENOMEM;
2365-
goto done;
2364+
rval = -ENOMEM;
2365+
return rval;
23662366
}
23672367

23682368
fcport = sa_ctl->fcport;

drivers/scsi/qla2xxx/qla_init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5549,7 +5549,7 @@ static void qla_get_login_template(scsi_qla_host_t *vha)
55495549
__be32 *q;
55505550

55515551
memset(ha->init_cb, 0, ha->init_cb_size);
5552-
sz = min_t(int, sizeof(struct fc_els_flogi), ha->init_cb_size);
5552+
sz = min_t(int, sizeof(struct fc_els_csp), ha->init_cb_size);
55535553
rval = qla24xx_get_port_login_templ(vha, ha->init_cb_dma,
55545554
ha->init_cb, sz);
55555555
if (rval != QLA_SUCCESS) {

drivers/scsi/qla2xxx/qla_inline.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,19 +109,22 @@ qla2x00_set_fcport_disc_state(fc_port_t *fcport, int state)
109109
{
110110
int old_val;
111111
uint8_t shiftbits, mask;
112+
uint8_t port_dstate_str_sz;
112113

113114
/* This will have to change when the max no. of states > 16 */
114115
shiftbits = 4;
115116
mask = (1 << shiftbits) - 1;
116117

118+
port_dstate_str_sz = sizeof(port_dstate_str) / sizeof(char *);
117119
fcport->disc_state = state;
118120
while (1) {
119121
old_val = atomic_read(&fcport->shadow_disc_state);
120122
if (old_val == atomic_cmpxchg(&fcport->shadow_disc_state,
121123
old_val, (old_val << shiftbits) | state)) {
122124
ql_dbg(ql_dbg_disc, fcport->vha, 0x2134,
123125
"FCPort %8phC disc_state transition: %s to %s - portid=%06x.\n",
124-
fcport->port_name, port_dstate_str[old_val & mask],
126+
fcport->port_name, (old_val & mask) < port_dstate_str_sz ?
127+
port_dstate_str[old_val & mask] : "Unknown",
125128
port_dstate_str[state], fcport->d_id.b24);
126129
return;
127130
}

drivers/scsi/qla2xxx/qla_iocb.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,8 @@ qla24xx_build_scsi_type_6_iocbs(srb_t *sp, struct cmd_type_6 *cmd_pkt,
607607
put_unaligned_le32(COMMAND_TYPE_6, &cmd_pkt->entry_type);
608608

609609
/* No data transfer */
610-
if (!scsi_bufflen(cmd) || cmd->sc_data_direction == DMA_NONE) {
610+
if (!scsi_bufflen(cmd) || cmd->sc_data_direction == DMA_NONE ||
611+
tot_dsds == 0) {
611612
cmd_pkt->byte_count = cpu_to_le32(0);
612613
return 0;
613614
}

drivers/scsi/qla2xxx/qla_os.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5088,7 +5088,8 @@ struct scsi_qla_host *qla2x00_create_host(const struct scsi_host_template *sht,
50885088
}
50895089
INIT_DELAYED_WORK(&vha->scan.scan_work, qla_scan_work_fn);
50905090

5091-
sprintf(vha->host_str, "%s_%lu", QLA2XXX_DRIVER_NAME, vha->host_no);
5091+
snprintf(vha->host_str, sizeof(vha->host_str), "%s_%lu",
5092+
QLA2XXX_DRIVER_NAME, vha->host_no);
50925093
ql_dbg(ql_dbg_init, vha, 0x0041,
50935094
"Allocated the host=%p hw=%p vha=%p dev_name=%s",
50945095
vha->host, vha->hw, vha,

drivers/scsi/qla2xxx/qla_version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
/*
77
* Driver version
88
*/
9-
#define QLA2XXX_VERSION "10.02.08.300-k"
9+
#define QLA2XXX_VERSION "10.02.08.400-k"
1010

1111
#define QLA_DRIVER_MAJOR_VER 10
1212
#define QLA_DRIVER_MINOR_VER 2
1313
#define QLA_DRIVER_PATCH_VER 8
14-
#define QLA_DRIVER_BETA_VER 300
14+
#define QLA_DRIVER_BETA_VER 400

0 commit comments

Comments
 (0)