mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-12 15:49:17 -04:00
msm: kgsl: Fix kvcalloc() calls
Depending on user input the size of the page struct that we try to allocate with kvcalloc() could be way too big. Add __GFP_NOWARN and __GFP_NORETRY to keep from invoking the OOM killer in these cases. Also remove an unneeded usage of kvmalloc() since the maximum allocation size for the HFI command will only be 1k as enforced on the previous line. Change-Id: Ic0dedbad8d09544bdc0070b9b797616ee1f672d4 Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
This commit is contained in:
parent
0977dc6d53
commit
c5f2680903
3 changed files with 6 additions and 4 deletions
|
|
@ -1200,7 +1200,7 @@ int a6xx_hwsched_submit_cmdobj(struct adreno_device *adreno_dev,
|
|||
if (WARN_ON(cmd_sizebytes > HFI_MAX_MSG_SIZE))
|
||||
return -EMSGSIZE;
|
||||
|
||||
cmd = kvmalloc(cmd_sizebytes, GFP_KERNEL);
|
||||
cmd = kmalloc(cmd_sizebytes, GFP_KERNEL);
|
||||
if (cmd == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
@ -1264,7 +1264,7 @@ skipib:
|
|||
adreno_profile_submit_time(&time);
|
||||
|
||||
free:
|
||||
kvfree(cmd);
|
||||
kfree(cmd);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2346,7 +2346,8 @@ static int memdesc_sg_virt(struct kgsl_memdesc *memdesc, struct file *vmfile)
|
|||
if (sglen == 0 || sglen >= LONG_MAX)
|
||||
return -EINVAL;
|
||||
|
||||
pages = kvcalloc(sglen, sizeof(*pages), GFP_KERNEL);
|
||||
pages = kvcalloc(sglen, sizeof(*pages),
|
||||
GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN);
|
||||
if (pages == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
|
|||
|
|
@ -442,7 +442,8 @@ int kgsl_pool_alloc_pages(u64 size, struct page ***pages, struct device *dev)
|
|||
{
|
||||
int count = 0;
|
||||
int npages = size >> PAGE_SHIFT;
|
||||
struct page **local = kvcalloc(npages, sizeof(*local), GFP_KERNEL);
|
||||
struct page **local = kvcalloc(npages, sizeof(*local),
|
||||
GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN);
|
||||
u32 page_size, align;
|
||||
u64 len = size;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue