MCPcopy Create free account
hub / github.com/F-Stack/f-stack / WOULD_OVERFLOW

Function WOULD_OVERFLOW

freebsd/sys/malloc.h:278–284  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

276 */
277#define MUL_NO_OVERFLOW (1UL << (sizeof(size_t) * 8 / 2))
278static inline bool
279WOULD_OVERFLOW(size_t nmemb, size_t size)
280{
281
282 return ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) &&
283 nmemb > 0 && __SIZE_T_MAX / nmemb < size);
284}
285#undef MUL_NO_OVERFLOW
286#endif /* _KERNEL */
287

Callers 2

pfioctlFunction · 0.50
mallocarrayFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected