Merge "mm: cma: check the max limit for cma allocation"
This commit is contained in:
commit
0bdc62e764
1 changed files with 3 additions and 0 deletions
3
mm/cma.c
3
mm/cma.c
|
@ -392,6 +392,9 @@ struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align)
|
|||
bitmap_maxno = cma_bitmap_maxno(cma);
|
||||
bitmap_count = cma_bitmap_pages_to_bits(cma, count);
|
||||
|
||||
if (bitmap_count > bitmap_maxno)
|
||||
return NULL;
|
||||
|
||||
for (;;) {
|
||||
mutex_lock(&cma->lock);
|
||||
bitmap_no = bitmap_find_next_zero_area_off(cma->bitmap,
|
||||
|
|
Loading…
Add table
Reference in a new issue