Print this page
11927 Log, or optionally panic, on zero-length kmem allocations
Reviewed by: Dan McDonald <danmcd@joyent.com>
Reviewed by: Jason King <jason.brian.king@gmail.com>
*** 23,33 ****
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
! #pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/smbios_impl.h>
#include <sys/cmn_err.h>
#include <sys/varargs.h>
#include <sys/systm.h>
--- 23,35 ----
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
! /*
! * Copyright (c) 2015 Joyent, Inc. All rights reserved.
! */
#include <sys/smbios_impl.h>
#include <sys/cmn_err.h>
#include <sys/varargs.h>
#include <sys/systm.h>
*** 41,57 ****
}
void *
smb_alloc(size_t len)
{
! return (kmem_alloc(len, KM_SLEEP));
}
void *
smb_zalloc(size_t len)
{
! return (kmem_zalloc(len, KM_SLEEP));
}
void
smb_free(void *buf, size_t len)
{
--- 43,59 ----
}
void *
smb_alloc(size_t len)
{
! return (len > 0 ? kmem_alloc(len, KM_SLEEP) : NULL);
}
void *
smb_zalloc(size_t len)
{
! return (len > 0 ? kmem_zalloc(len, KM_SLEEP) : NULL);
}
void
smb_free(void *buf, size_t len)
{