Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion kernel-open/nvidia/nv.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,15 @@ nv_alloc_t *nvos_create_alloc(
return NULL;
}

at->page_table = kvzalloc(pt_size, NV_GFP_KERNEL);
/*
* kvmalloc()/kvzalloc() reject sizes larger than INT_MAX before
* falling back to vmalloc. Large registered system-memory ranges can
* require a page table larger than that, so use vzalloc() directly.
*/
if (pt_size > (NvU64)INT_MAX)
at->page_table = vzalloc(pt_size);
else
at->page_table = kvzalloc(pt_size, NV_GFP_KERNEL);
if (at->page_table == NULL)
{
nv_printf(NV_DBG_ERRORS, "NVRM: failed to allocate page table\n");
Expand Down