From 384c3ce8d25837258013a1eefd7267c75f6df4f6 Mon Sep 17 00:00:00 2001 From: trasz Date: Fri, 23 Jan 2009 21:03:59 +0000 Subject: Guard against NULL pointer dereference. Reviewed by: scottl Approved by: rwatson (mentor) Sponsored by: FreeBSD Foundation Found with: Coverity Prevent(tm) CID: 130 --- sys/cam/cam_periph.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c index 3abeed8..9fdc112 100644 --- a/sys/cam/cam_periph.c +++ b/sys/cam/cam_periph.c @@ -171,6 +171,10 @@ cam_periph_alloc(periph_ctor_t *periph_ctor, break; } xpt_unlock_buses(); + if (p_drv == NULL) { + printf("cam_periph_alloc: invalid periph name '%s'\n", name); + return (CAM_REQ_INVALID); + } sim = xpt_path_sim(path); path_id = xpt_path_path_id(path); -- cgit v1.1