svn commit: r299257 - head/sys/kern

Andrew Turner andrew at FreeBSD.org
Mon May 9 12:24:40 UTC 2016


Author: andrew
Date: Mon May  9 12:24:39 2016
New Revision: 299257
URL: https://svnweb.freebsd.org/changeset/base/299257

Log:
  Check malloc succeeded in pic_create, with M_NOWAIT it may return NULL.
  
  Obtained from:	ABT Systems Ltd
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/kern/subr_intr.c

Modified: head/sys/kern/subr_intr.c
==============================================================================
--- head/sys/kern/subr_intr.c	Mon May  9 11:52:57 2016	(r299256)
+++ head/sys/kern/subr_intr.c	Mon May  9 12:24:39 2016	(r299257)
@@ -871,6 +871,10 @@ pic_create(device_t dev, intptr_t xref)
 		return (pic);
 	}
 	pic = malloc(sizeof(*pic), M_INTRNG, M_NOWAIT | M_ZERO);
+	if (pic == NULL) {
+		mtx_unlock(&pic_list_lock);
+		return (NULL);
+	}
 	pic->pic_xref = xref;
 	pic->pic_dev = dev;
 	SLIST_INSERT_HEAD(&pic_list, pic, pic_next);


More information about the svn-src-all mailing list