Skip to contentSkip to conversation

fnic: Using rport->dd_data to check rport online instead of rport_lookup.

DISCUSSION Dan Carpenter 2 participants 2 messages Apr 1, 2016 – Apr 12, 2016 SCSI

lore
Share & tools
lore
#0 lore raw

Hello Satish Kharat,

This is a semi-automatic email about new static checker warnings.

The patch ce4b9e8980fa: "fnic: Using rport->dd_data to check rport online instead of rport_lookup." from Mar 18, 2016, leads to the following Smatch complaint:

drivers/scsi/fnic/fnic_scsi.c:457 fnic_queuecommand_lck()
warn: variable dereferenced before check 'rport' (see line 449)

drivers/scsi/fnic/fnic_scsi.c
448 rport = starget_to_rport(scsi_target(sc->device));

   449		ret = fc_remote_port_chkready(rport);
                                              ^^^^^

Old dereference (inside function call).

450 if (ret) {
451 atomic64_inc(&fnic_stats->misc_stats.rport_not_ready);
452 sc->result = ret;
453 done(sc);
454 return 0;
455 }
456

   457		if (rport) {
                    ^^^^^

The patch adds a check but too late. Probably just delete the check?

   458			struct fc_rport_libfc_priv *rp = rport->dd_data;
   459	

regards,
dan carpenter

#1 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Dan" == Dan Carpenter <[email protected]> writes:

Dan> The patch ce4b9e8980fa: "fnic: Using rport->dd_data to check rport Dan> online instead of rport_lookup." from Mar 18, 2016, leads to the Dan> following Smatch complaint:

Dan> drivers/scsi/fnic/fnic_scsi.c:457 fnic_queuecommand_lck() warn:
Dan> variable dereferenced before check 'rport' (see line 449)

Satish?

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering