diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2016-09-19 17:07:06 +0200 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-09-21 13:24:27 +0200 |
commit | 2027400893a2fa03d764f62ca8e0c677d7691234 (patch) | |
tree | f9bfe2ff615004c1107ea15aae869b182b7cdf12 /drivers | |
parent | 823d1bc1082970fc02f8172859c789933ed84bc5 (diff) | |
download | linux-2027400893a2fa03d764f62ca8e0c677d7691234.tar.bz2 |
GPU-DRM: Use kmalloc_array() in drm_legacy_addbufs_pci()
A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/b71c8fee-8e84-9f1b-8569-f1ae8b879cc5@users.sourceforge.net
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/drm_bufs.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index 32191513e82d..ed33f4362dfe 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c @@ -923,8 +923,9 @@ int drm_legacy_addbufs_pci(struct drm_device *dev, /* Keep the original pagelist until we know all the allocations * have succeeded */ - temp_pagelist = kmalloc((dma->page_count + (count << page_order)) * - sizeof(*dma->pagelist), GFP_KERNEL); + temp_pagelist = kmalloc_array(dma->page_count + (count << page_order), + sizeof(*dma->pagelist), + GFP_KERNEL); if (!temp_pagelist) { kfree(entry->buflist); kfree(entry->seglist); |