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);
_______________________________________________
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