svn commit: r187650 - head/sys/cam

Edward Tomasz Napierala trasz at FreeBSD.org
Fri Jan 23 13:05:17 PST 2009


Author: trasz
Date: Fri Jan 23 21:05:16 2009
New Revision: 187650
URL: http://svn.freebsd.org/changeset/base/187650

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

Modified:
  head/sys/cam/cam_xpt.c

Modified: head/sys/cam/cam_xpt.c
==============================================================================
--- head/sys/cam/cam_xpt.c	Fri Jan 23 21:03:59 2009	(r187649)
+++ head/sys/cam/cam_xpt.c	Fri Jan 23 21:05:16 2009	(r187650)
@@ -4177,7 +4177,10 @@ xpt_path_string(struct cam_path *path, c
 {
 	struct sbuf sb;
 
-	mtx_assert(path->bus->sim->mtx, MA_OWNED);
+#ifdef INVARIANTS
+	if (path != NULL && path->bus != NULL && path->bus->sim != NULL)
+		mtx_assert(path->bus->sim->mtx, MA_OWNED);
+#endif
 
 	sbuf_new(&sb, str, str_len, 0);
 


More information about the svn-src-head mailing list