summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorsbruno <sbruno@FreeBSD.org>2014-06-29 18:38:44 +0000
committersbruno <sbruno@FreeBSD.org>2014-06-29 18:38:44 +0000
commitaf69ed37812081d1cef71e77ec81f201216843d3 (patch)
tree4f766c3a48e83523b45f76c9f3178785805966fd /sys/dev
parentc541d153a4de86824c019c4f721ac953364eb4a0 (diff)
downloadFreeBSD-src-af69ed37812081d1cef71e77ec81f201216843d3.zip
FreeBSD-src-af69ed37812081d1cef71e77ec81f201216843d3.tar.gz
Check return of cam_periph_find() before using it in a printf.
If cam_periph_find() doesn't locate the path we requested, bail to error condition. Acquire ciss->mtx for this operation. Reviewed by: "Benesh, Scott" <scott.benesh@hp.com> MFC after: 2 weeks
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ciss/ciss.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/dev/ciss/ciss.c b/sys/dev/ciss/ciss.c
index c8dee70..9553fb4 100644
--- a/sys/dev/ciss/ciss.c
+++ b/sys/dev/ciss/ciss.c
@@ -3429,13 +3429,17 @@ ciss_name_device(struct ciss_softc *sc, int bus, int target)
target, 0);
if (status == CAM_REQ_CMP) {
+ mtx_lock(&sc->ciss_mtx);
xpt_path_lock(path);
periph = cam_periph_find(path, NULL);
- sprintf(sc->ciss_logical[bus][target].cl_name, "%s%d",
- periph->periph_name, periph->unit_number);
xpt_path_unlock(path);
+ mtx_unlock(&sc->ciss_mtx);
xpt_free_path(path);
- return(0);
+ if (periph != NULL) {
+ sprintf(sc->ciss_logical[bus][target].cl_name, "%s%d",
+ periph->periph_name, periph->unit_number);
+ return(0);
+ }
}
sc->ciss_logical[bus][target].cl_name[0] = 0;
return(ENOENT);
OpenPOWER on IntegriCloud