svn commit: r187649 - head/sys/cam

Edward Tomasz Napierala trasz at FreeBSD.org
Fri Jan 23 13:03:59 PST 2009


Author: trasz
Date: Fri Jan 23 21:03:59 2009
New Revision: 187649
URL: http://svn.freebsd.org/changeset/base/187649

Log:
  Guard against NULL pointer dereference.
  
  Reviewed by:	scottl
  Approved by:	rwatson (mentor)
  Sponsored by:	FreeBSD Foundation
  Found with:	Coverity Prevent(tm)
  CID:		130

Modified:
  head/sys/cam/cam_periph.c

Modified: head/sys/cam/cam_periph.c
==============================================================================
--- head/sys/cam/cam_periph.c	Fri Jan 23 20:53:01 2009	(r187648)
+++ head/sys/cam/cam_periph.c	Fri Jan 23 21:03:59 2009	(r187649)
@@ -171,6 +171,10 @@ cam_periph_alloc(periph_ctor_t *periph_c
 			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);


More information about the svn-src-head mailing list