vchiq: Use mallocarray() to provide kcalloc()

This means we now also provide integer overflow protection, like the
Linux kcalloc().
This commit is contained in:
Kristof Provost 2018-01-07 13:41:06 +00:00
parent e70c77ca17
commit 5cf32a6e95
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=327677

View File

@ -329,7 +329,8 @@ device_rlprintf(int pps, device_t dev, const char *fmt, ...)
MALLOC_DECLARE(M_VCHI);
#define kmalloc(size, flags) malloc((size), M_VCHI, M_NOWAIT | M_ZERO)
#define kcalloc(n, size, flags) malloc((n) * (size), M_VCHI, M_NOWAIT | M_ZERO)
#define kcalloc(n, size, flags) mallocarray((n), (size), M_VCHI, \
M_NOWAIT | M_ZERO)
#define kzalloc(a, b) kcalloc(1, (a), (b))
#define kfree(p) free(p, M_VCHI)