diff options
| author | Zi Yan <ziy@nvidia.com> | 2026-08-30 22:23:23 -0400 |
|---|---|---|
| committer | Vlastimil Babka (SUSE) <vbabka@kernel.org> | 2026-09-02 16:04:16 +0200 |
| commit | 874d785e89a6925a08a59c65a93526d7a8c91403 (patch) | |
| tree | 29a75d635b0ac648df35054074a51086509c4052 /tools/lib/python/kdoc/python_version.py | |
| parent | cee9395acd8043be0644b25c34bfa86623f2b935 (diff) | |
| download | linux-next-874d785e89a6925a08a59c65a93526d7a8c91403.tar.gz linux-next-874d785e89a6925a08a59c65a93526d7a8c91403.zip | |
mm/slab: reject unsupported kmalloc() sizes
kmalloc() is used to allocate physically contiguous memory for kernel
allocations. For requests larger than KMALLOC_MAX_CACHE_SIZE, kmalloc()
uses the page allocator and can only support up to KMALLOC_MAX_SIZE. For
request sizes bigger than KMALLOC_MAX_SIZE, the page allocator can emit a
WARN because kmalloc() allocates an order greater than MAX_PAGE_ORDER. To
make the KMALLOC_MAX_SIZE limit more explicit instead of relying on the
page allocator check, add a KMALLOC_MAX_SIZE check inside kmalloc() to emit
a WARN and return NULL for requested sizes bigger than KMALLOC_MAX_SIZE.
Like the WARN in the page allocator and kvmalloc(), allow __GFP_NOWARN to
suppress the WARN.
Suggested-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Signed-off-by: Zi Yan <ziy@nvidia.com>
Link: https://patch.msgid.link/20260830-limit_kmalloc_size-v2-1-bf4ca9c63c88@nvidia.com
Reviewed-by: Harry Yoo (Meta) <harry@kernel.org>
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Diffstat (limited to 'tools/lib/python/kdoc/python_version.py')
0 files changed, 0 insertions, 0 deletions
