Skip to contentSkip to conversation

ncr5380: Implement new eh_bus_reset_handler

DISCUSSION Dan Carpenter 1 participant 1 message Jan 20, 2016 SCSI

lore
Share & tools
lore
#0 lore raw

Hello Finn Thain,

The patch 62717f537e1b: "ncr5380: Implement new eh_bus_reset_handler" from Jan 3, 2016, leads to the following static checker warning:

	drivers/scsi/NCR5380.c:2476 NCR5380_bus_reset()
	error: potential NULL dereference 'hostdata->connected'.

drivers/scsi/NCR5380.c
2468

  2469          if (hostdata->connected) {
                    ^^^^^^^^^^^^^^^^^^^
  2470                  set_host_byte(hostdata->connected, DID_RESET);
  2471                  complete_cmd(instance, hostdata->connected);
  2472                  hostdata->connected = NULL;
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^

->connected is NULL because it either starts as NULL or we set it to NULL.

2473 }
2474
2475 if (hostdata->sensing) {

  2476                  set_host_byte(hostdata->connected, DID_RESET);
                                      ^^^^^^^^^^^^^^^^^^^

It leads to a NULL dereference here.

  2477                  complete_cmd(instance, hostdata->sensing);
  2478                  hostdata->sensing = NULL;
  2479          }
  2480  
  2481          for (i = 0; i < 8; ++i)
  2482                  hostdata->busy[i] = 0;

regards,
dan carpenter