linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* re: ncr5380: Implement new eh_bus_reset_handler
@ 2016-01-19  9:31 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2016-01-19  9:31 UTC (permalink / raw)
  To: fthain; +Cc: linux-scsi

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-01-20  4:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-19  9:31 ncr5380: Implement new eh_bus_reset_handler Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).