diff options
author | Pedro F. Giffuni <pfg@FreeBSD.org> | 2018-01-22 15:55:51 +0000 |
---|---|---|
committer | Pedro F. Giffuni <pfg@FreeBSD.org> | 2018-01-22 15:55:51 +0000 |
commit | 7d81f67b88036ca76480c33b9a7454acdb37ee1c (patch) | |
tree | 86a6988166ff6697c45957ae6f7992fc9bea752b | |
parent | 67e8bb2f5ef6290f07e8d88fa4daea6e9a5a9a9c (diff) |
Notes
-rw-r--r-- | sys/dev/drm2/drm_mem_util.h | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/sys/dev/drm2/drm_mem_util.h b/sys/dev/drm2/drm_mem_util.h index 01ca720ba0f0..68bb3a9cd70d 100644 --- a/sys/dev/drm2/drm_mem_util.h +++ b/sys/dev/drm2/drm_mem_util.h @@ -36,19 +36,15 @@ __FBSDID("$FreeBSD$"); static __inline__ void *drm_calloc_large(size_t nmemb, size_t size) { - if (size != 0 && nmemb > SIZE_MAX / size) - return NULL; - return malloc(nmemb * size, DRM_MEM_DRIVER, M_NOWAIT | M_ZERO); + return mallocarray(nmemb, size, DRM_MEM_DRIVER, M_NOWAIT | M_ZERO); } /* Modeled after cairo's malloc_ab, it's like calloc but without the zeroing. */ static __inline__ void *drm_malloc_ab(size_t nmemb, size_t size) { - if (size != 0 && nmemb > SIZE_MAX / size) - return NULL; - return malloc(nmemb * size, DRM_MEM_DRIVER, M_NOWAIT); + return mallocarray(nmemb, size, DRM_MEM_DRIVER, M_NOWAIT); } static __inline void drm_free_large(void *ptr) |