Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Jan 2018 00:00:55 +0000 (UTC)
From:      Scott Long <scottl@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r327709 - head/sys/cam
Message-ID:  <201801090000.w0900t4Y068919@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)					\



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801090000.w0900t4Y068919>