qla2xxx: Enable >= 24xx target-mode support in SCSI LLD
Subsystems (2)
Hello Nicholas,
The patch bb52e091fe63: "qla2xxx: Enable >= 24xx target-mode support in SCSI LLD" from Mar 8, 2012, leads to the following Smatch warning:
drivers/scsi/qla2xxx/qla_mbx.c:1458 qla2x00_get_port_database()
error: potential null derefence 'pd24'.
drivers/scsi/qla2xxx/qla_mbx.c
1456
1457 /* If not target must be initiator or unknown type. */
1458 if ((pd24->prli_svc_param_word_3[0] & BIT_4))
^^^^^^
1459 fcport->port_type = FCT_TARGET;
1460 else if ((pd24->prli_svc_param_word_3[0] & BIT_5))
^^^^^^These are always NULL here.
1461 fcport->port_type = FCT_INITIATOR; 1462
regards,
dan carpenter
Quoted 12 lines · Dan Carpenter
Hello Nicholas,
The patch
bb52e091fe63: "qla2xxx: Enable >= 24xx target-mode support in SCSI LLD" from Mar 8, 2012, leads to the following Smatch warning:
drivers/scsi/qla2xxx/qla_mbx.c:1458qla2x00_get_port_database()
error: potential null derefence 'pd24'.
drivers/scsi/qla2xxx/qla_mbx.c
1456
1457 /* If not target must be initiator or unknown type. */
1458 if ((pd24->prli_svc_param_word_3[0] &BIT_4))
Quoted 9 lines
^^^^^^ 1459 fcport->port_type = FCT_TARGET; 1460 else if ((pd24->prli_svc_param_word_3[0] & BIT_5)) ^^^^^^These are always NULL here.
1461 fcport->port_type = FCT_INITIATOR; 1462
Fixing this up with the following patch. Also, I believe this bit has already be added to mainline, so I'll look at dropping this part of code from for-next-merge.
Thanks Dan!
--nab
drivers/scsi/qla2xxx/qla_mbx.c +2 -2
@@ -1407,9 +1407,9 @@ qla2x00_get_port_database(scsi_qla_host_t *vha, fc_port_t *fcport, uint8_t opt) fcport->d_id.b.rsvd_1 =0 ;/* If not target must be initiator or unknown type. */ -if ((pd24->prli_svc_param_word_3[0 ] &BIT_4 )) +if ((pd->prli_svc_param_word_3[0 ] &BIT_4 )) fcport->port_type =FCT_TARGET ; -else if ((pd24->prli_svc_param_word_3[0 ] &BIT_5 )) +else if ((pd->prli_svc_param_word_3[0 ] &BIT_5 )) fcport->port_type =FCT_INITIATOR ;