done_ccb pointer can be used if it is NULL.

To prevent this, move check for done_ccb == NULL to before done_ccb is used in
mprsas_stop_unit_done().

Reviewed by:    ken, scottl, ambrisko, asomers
Approved by:	ken, scottl, ambrisko
MFC after:      1 week
Differential Revision: https://reviews.freebsd.org/D6099
This commit is contained in:
Stephen McConnell 2016-05-09 16:34:06 +00:00
parent 407073a044
commit 5d21655f67

View File

@ -1272,15 +1272,15 @@ mprsas_stop_unit_done(struct cam_periph *periph, union ccb *done_ccb)
struct mprsas_softc *sassc;
char path_str[64];
if (done_ccb == NULL)
return;
sassc = (struct mprsas_softc *)done_ccb->ccb_h.ppriv_ptr1;
xpt_path_string(done_ccb->ccb_h.path, path_str, sizeof(path_str));
mpr_dprint(sassc->sc, MPR_INFO, "Completing stop unit for %s\n",
path_str);
if (done_ccb == NULL)
return;
/*
* Nothing more to do except free the CCB and path. If the command
* timed out, an abort reset, then target reset will be issued during