Linux SCSI subsystem development
 help / color / mirror / Atom feed
* re: [SCSI] pm80xx: Print SAS address of IO failed device.
@ 2013-11-01 10:29 Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2013-11-01 10:29 UTC (permalink / raw)
  To: AnandKumar.Santhanam; +Cc: linux-scsi

Hello Anand Kumar Santhanam,

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

The patch cb269c26ed02: "[SCSI] pm80xx: Print SAS address of IO 
failed device." from Sep 17, 2013, leads to the following Smatch 
complaint:

drivers/scsi/pm8001/pm8001_hwi.c:2343 mpi_sata_completion()
	 error: we previously assumed 't->dev' could be null (see line 2319)

drivers/scsi/pm8001/pm8001_hwi.c
  2318		if (t) {
  2319			if (t->dev && (t->dev->lldd_dev))
                            ^^^^^
Exisiting check.

  2320				pm8001_dev = t->dev->lldd_dev;
  2321		} else {
  2322			PM8001_FAIL_DBG(pm8001_ha,
  2323				pm8001_printk("task null\n"));
  2324			return;
  2325		}
  2326	
  2327		if ((pm8001_dev && !(pm8001_dev->id & NCQ_READ_LOG_FLAG))
  2328			&& unlikely(!t || !t->lldd_task || !t->dev)) {
                                                           ^^^^^^^
Existing check.

  2329			PM8001_FAIL_DBG(pm8001_ha,
  2330				pm8001_printk("task or dev null\n"));
  2331			return;
  2332		}
  2333	
  2334		ts = &t->task_status;
  2335		if (!ts) {
  2336			PM8001_FAIL_DBG(pm8001_ha,
  2337				pm8001_printk("ts null\n"));
  2338			return;
  2339		}
  2340		/* Print sas address of IO failed device */
  2341		if ((status != IO_SUCCESS) && (status != IO_OVERFLOW) &&
  2342			(status != IO_UNDERFLOW)) {
  2343			if (!((t->dev->parent) &&
                               ^^^^^^^^
Patch introduces new unchecked dereference.

  2344				(DEV_IS_EXPANDER(t->dev->parent->dev_type)))) {
  2345				for (i = 0 , j = 4; j <= 7 && i <= 3; i++ , j++)

regards,
dan carpenter

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

* re: [SCSI] pm80xx: Print SAS address of IO failed device.
@ 2013-11-01 10:29 Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2013-11-01 10:29 UTC (permalink / raw)
  To: AnandKumar.Santhanam; +Cc: linux-scsi

Hello Anand Kumar Santhanam,

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

The patch cb269c26ed02: "[SCSI] pm80xx: Print SAS address of IO 
failed device." from Sep 17, 2013, leads to the following Smatch 
complaint:

drivers/scsi/pm8001/pm8001_hwi.c:2368 mpi_sata_completion()
	 error: we previously assumed 'pm8001_dev' could be null (see line 2327)

drivers/scsi/pm8001/pm8001_hwi.c
  2326	
  2327		if ((pm8001_dev && !(pm8001_dev->id & NCQ_READ_LOG_FLAG))
                     ^^^^^^^^^^
Existing check.

  2328			&& unlikely(!t || !t->lldd_task || !t->dev)) {
  2329			PM8001_FAIL_DBG(pm8001_ha,
  2330				pm8001_printk("task or dev null\n"));
  2331			return;
  2332		}
  2333	
  2334		ts = &t->task_status;
  2335		if (!ts) {
  2336			PM8001_FAIL_DBG(pm8001_ha,
  2337				pm8001_printk("ts null\n"));
  2338			return;
  2339		}
  2340		/* Print sas address of IO failed device */
  2341		if ((status != IO_SUCCESS) && (status != IO_OVERFLOW) &&
  2342			(status != IO_UNDERFLOW)) {
  2343			if (!((t->dev->parent) &&
  2344				(DEV_IS_EXPANDER(t->dev->parent->dev_type)))) {
  2345				for (i = 0 , j = 4; j <= 7 && i <= 3; i++ , j++)
  2346					sata_addr_low[i] = pm8001_ha->sas_addr[j];
  2347				for (i = 0 , j = 0; j <= 3 && i <= 3; i++ , j++)
  2348					sata_addr_hi[i] = pm8001_ha->sas_addr[j];
  2349				memcpy(&temp_sata_addr_low, sata_addr_low,
  2350					sizeof(sata_addr_low));
  2351				memcpy(&temp_sata_addr_hi, sata_addr_hi,
  2352					sizeof(sata_addr_hi));
  2353				temp_sata_addr_hi = (((temp_sata_addr_hi >> 24) & 0xff)
  2354							|((temp_sata_addr_hi << 8) &
  2355							0xff0000) |
  2356							((temp_sata_addr_hi >> 8)
  2357							& 0xff00) |
  2358							((temp_sata_addr_hi << 24) &
  2359							0xff000000));
  2360				temp_sata_addr_low = ((((temp_sata_addr_low >> 24)
  2361							& 0xff) |
  2362							((temp_sata_addr_low << 8)
  2363							& 0xff0000) |
  2364							((temp_sata_addr_low >> 8)
  2365							& 0xff00) |
  2366							((temp_sata_addr_low << 24)
  2367							& 0xff000000)) +
  2368							pm8001_dev->attached_phy +
                                                        ^^^^^^^^^^^^^^^^^^^^^^^^
Patch introduces new unchecked dereference.

  2369							0x10);
  2370				PM8001_FAIL_DBG(pm8001_ha,

regards,
dan carpenter

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

end of thread, other threads:[~2013-11-01 10:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-01 10:29 [SCSI] pm80xx: Print SAS address of IO failed device Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2013-11-01 10:29 Dan Carpenter

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