Author: oshogbo
Date: Sat May  2 18:12:34 2015
New Revision: 282350
URL: https://svnweb.freebsd.org/changeset/base/282350

Log:
  nv_malloc can fail in userland.
  Add check to prevent a NULL pointer dereference.
  
  Pointed out by:       mjg
  Approved by:  pjd (mentor)

Modified:
  head/sys/kern/subr_nvlist.c

Modified: head/sys/kern/subr_nvlist.c
==============================================================================
--- head/sys/kern/subr_nvlist.c Sat May  2 18:10:45 2015        (r282349)
+++ head/sys/kern/subr_nvlist.c Sat May  2 18:12:34 2015        (r282350)
@@ -129,6 +129,8 @@ nvlist_create(int flags)
        PJDLOG_ASSERT((flags & ~(NV_FLAG_PUBLIC_MASK)) == 0);
 
        nvl = nv_malloc(sizeof(*nvl));
+       if (nvl == NULL)
+               return (NULL);
        nvl->nvl_error = 0;
        nvl->nvl_flags = flags;
        nvl->nvl_parent = NULL;
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to