Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/malloc.h
Show All 31 Lines | |||||
* | * | ||||
* @(#)malloc.h 8.5 (Berkeley) 5/3/95 | * @(#)malloc.h 8.5 (Berkeley) 5/3/95 | ||||
* $FreeBSD$ | * $FreeBSD$ | ||||
*/ | */ | ||||
#ifndef _SYS_MALLOC_H_ | #ifndef _SYS_MALLOC_H_ | ||||
#define _SYS_MALLOC_H_ | #define _SYS_MALLOC_H_ | ||||
#ifndef _STANDALONE | |||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#ifdef _KERNEL | #ifdef _KERNEL | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#endif | #endif | ||||
#include <sys/queue.h> | #include <sys/queue.h> | ||||
#include <sys/_lock.h> | #include <sys/_lock.h> | ||||
#include <sys/_mutex.h> | #include <sys/_mutex.h> | ||||
#include <machine/_limits.h> | #include <machine/_limits.h> | ||||
▲ Show 20 Lines • Show All 213 Lines • ▼ Show 20 Lines | |||||
WOULD_OVERFLOW(size_t nmemb, size_t size) | WOULD_OVERFLOW(size_t nmemb, size_t size) | ||||
{ | { | ||||
return ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && | return ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && | ||||
nmemb > 0 && __SIZE_T_MAX / nmemb < size); | nmemb > 0 && __SIZE_T_MAX / nmemb < size); | ||||
} | } | ||||
#undef MUL_NO_OVERFLOW | #undef MUL_NO_OVERFLOW | ||||
#endif /* _KERNEL */ | #endif /* _KERNEL */ | ||||
#endif /* _STANDALONE */ | |||||
#endif /* !_SYS_MALLOC_H_ */ | #endif /* !_SYS_MALLOC_H_ */ |