Author: scottl
Date: Tue Jan  9 00:00:55 2018
New Revision: 327709
URL: https://svnweb.freebsd.org/changeset/base/327709

Log:
  Protect against a possible NULL deference from an accessor
  function.
  
  Obtained from:        Netflix

Modified:
  head/sys/cam/cam_periph.h

Modified: head/sys/cam/cam_periph.h
==============================================================================
--- head/sys/cam/cam_periph.h   Mon Jan  8 22:59:36 2018        (r327708)
+++ head/sys/cam/cam_periph.h   Tue Jan  9 00:00:55 2018        (r327709)
@@ -202,7 +202,10 @@ int                cam_periph_error(union ccb *ccb, 
cam_flags camfla
 static __inline struct mtx *
 cam_periph_mtx(struct cam_periph *periph)
 {
-       return (xpt_path_mtx(periph->path));
+       if (periph != NULL)
+               return (xpt_path_mtx(periph->path));
+       else
+               return (NULL);
 }
 
 #define cam_periph_owned(periph)                                       \
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to