From: Zhou Guanghui zhouguanghui1@huawei.com
ascend inclusion category: feature bugzilla: NA CVE: NA
-------------------------------------------------
If the memory size of a single pin operation exceeds 2GB, the memory size required for storing pages exceeds 4MB. In this case, the allocation using kcalloc fails.
Signed-off-by: Zhou Guanghui zhouguanghui1@huawei.com Reviewed-by: Ding Tianhong dingtianhong@huawei.com Reviewed-by: Kefeng Wang wangkefeng.wang@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/char/svm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/char/svm.c b/drivers/char/svm.c index 4cf6f75f7459..f312b7e02263 100644 --- a/drivers/char/svm.c +++ b/drivers/char/svm.c @@ -585,7 +585,7 @@ static void svm_remove_sdma(struct svm_process *process, if (null_count) dump_stack();
- kfree(sdma->pages); + kvfree(sdma->pages); kfree(sdma); }
@@ -620,7 +620,7 @@ static int svm_add_sdma(struct svm_process *process, sdma->addr = addr & PAGE_MASK; sdma->nr_pages = (PAGE_ALIGN(size + addr) >> PAGE_SHIFT) - (sdma->addr >> PAGE_SHIFT); - sdma->pages = kcalloc(sdma->nr_pages, sizeof(char *), GFP_KERNEL); + sdma->pages = kvcalloc(sdma->nr_pages, sizeof(char *), GFP_KERNEL); if (sdma->pages == NULL) { err = -ENOMEM; goto err_free_sdma; @@ -650,7 +650,7 @@ static int svm_add_sdma(struct svm_process *process, while (sdma->nr_pages--) put_page(sdma->pages[sdma->nr_pages]); err_free_pages: - kfree(sdma->pages); + kvfree(sdma->pages); err_free_sdma: kfree(sdma);