public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* re: qla2xxx: Enable >= 24xx target-mode support in SCSI LLD
@ 2012-03-13 17:20 Dan Carpenter
  2012-03-15 22:59 ` Nicholas A. Bellinger
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2012-03-13 17:20 UTC (permalink / raw)
  To: nab; +Cc: linux-driver, linux-scsi

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* re: qla2xxx: Enable >= 24xx target-mode support in SCSI LLD
  2012-03-13 17:20 qla2xxx: Enable >= 24xx target-mode support in SCSI LLD Dan Carpenter
@ 2012-03-15 22:59 ` Nicholas A. Bellinger
  0 siblings, 0 replies; 2+ messages in thread
From: Nicholas A. Bellinger @ 2012-03-15 22:59 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: linux-driver, linux-scsi, Andrew Vasquez, Giridhar Malavali,
	target-devel

On Tue, 2012-03-13 at 20:20 +0300, Dan Carpenter wrote:
> 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  
> 

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

diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 7b38a66..24a5663 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -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;
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-03-15 22:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-13 17:20 qla2xxx: Enable >= 24xx target-mode support in SCSI LLD Dan Carpenter
2012-03-15 22:59 ` Nicholas A. Bellinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox