aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm
diff options
context:
space:
mode:
Diffstat (limited to 'include/drm')
-rw-r--r--include/drm/drmP.h12
1 files changed, 4 insertions, 8 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index afc21685230e..1cc51a0812fe 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1573,18 +1573,14 @@ static __inline__ void *drm_calloc(size_t nmemb, size_t size, int area)
1573 1573
1574static __inline__ void *drm_calloc_large(size_t nmemb, size_t size) 1574static __inline__ void *drm_calloc_large(size_t nmemb, size_t size)
1575{ 1575{
1576 u8 *addr; 1576 if (size * nmemb <= PAGE_SIZE)
1577
1578 if (size <= PAGE_SIZE)
1579 return kcalloc(nmemb, size, GFP_KERNEL); 1577 return kcalloc(nmemb, size, GFP_KERNEL);
1580 1578
1581 addr = vmalloc(nmemb * size); 1579 if (size != 0 && nmemb > ULONG_MAX / size)
1582 if (!addr)
1583 return NULL; 1580 return NULL;
1584 1581
1585 memset(addr, 0, nmemb * size); 1582 return __vmalloc(size * nmemb,
1586 1583 GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, PAGE_KERNEL);
1587 return addr;
1588} 1584}
1589 1585
1590static __inline void drm_free_large(void *ptr) 1586static __inline void drm_free_large(void *ptr)