[PATCH] kasan: update outdated comment

0 views
Skip to first unread message

Kexin Sun

unread,
Mar 11, 2026, 9:38:42 AM (10 days ago) Mar 11
to ryabin...@gmail.com, kasa...@googlegroups.com, gli...@google.com, andre...@gmail.com, dvy...@google.com, vincenzo...@arm.com, linux-...@vger.kernel.org, julia....@inria.fr, xuto...@inria.fr, yunb...@smu.edu.sg, ratna...@smu.edu.sg, Kexin Sun
The function kmalloc_large() was renamed kmalloc_large_noprof() by
commit 7bd230a26648 ("mm/slab: enable slab allocation tagging for
kmalloc and friends"), and subsequently renamed __kmalloc_large_noprof()
by commit a0a44d9175b3 ("mm, slab: don't wrap internal functions with
alloc_hooks()"), making it an internal implementation detail.

Large kmalloc allocations are now performed through the public kmalloc()
interface directly. Update the comment to remove the stale reference to
kmalloc_large() accordingly.

Assisted-by: unnamed:deepseek-v3.2 coccinelle
Signed-off-by: Kexin Sun <kexi...@smail.nju.edu.cn>
---
include/linux/kasan.h | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/include/linux/kasan.h b/include/linux/kasan.h
index 338a1921a50a..4cb600f5e521 100644
--- a/include/linux/kasan.h
+++ b/include/linux/kasan.h
@@ -352,8 +352,7 @@ bool __kasan_mempool_poison_object(void *ptr, unsigned long ip);
* kasan_mempool_unpoison_object().
*
* This function operates on all slab allocations including large kmalloc
- * allocations (the ones returned by kmalloc_large() or by kmalloc() with the
- * size > KMALLOC_MAX_SIZE).
+ * allocations (the ones returned by kmalloc() with the size > KMALLOC_MAX_SIZE).
*
* Return: true if the allocation can be safely reused; false otherwise.
*/
@@ -381,8 +380,7 @@ void __kasan_mempool_unpoison_object(void *ptr, size_t size, unsigned long ip);
* original tags based on the pointer value.
*
* This function operates on all slab allocations including large kmalloc
- * allocations (the ones returned by kmalloc_large() or by kmalloc() with the
- * size > KMALLOC_MAX_SIZE).
+ * allocations (the ones returned by kmalloc() with the size > KMALLOC_MAX_SIZE).
*/
static __always_inline void kasan_mempool_unpoison_object(void *ptr,
size_t size)
--
2.25.1

Andrey Ryabinin

unread,
Mar 11, 2026, 1:22:53 PM (10 days ago) Mar 11
to Kexin Sun, kasa...@googlegroups.com, gli...@google.com, andre...@gmail.com, dvy...@google.com, vincenzo...@arm.com, linux-...@vger.kernel.org, julia....@inria.fr, xuto...@inria.fr, yunb...@smu.edu.sg, ratna...@smu.edu.sg
The KMALLOC_MAX_SIZE reference is not correct here. It should be
KMALLOC_MAX_CACHE_SIZE.
Perhaps it would be better to remove it and reprase it to something like:
(i.e. allocations backed directly by buddy allocator rather than
kmalloc slab caches)

Kexin Sun

unread,
Mar 12, 2026, 1:39:06 AM (9 days ago) Mar 12
to ryabin...@gmail.com, kasa...@googlegroups.com, gli...@google.com, andre...@gmail.com, dvy...@google.com, vincenzo...@arm.com, linux-...@vger.kernel.org, julia....@inria.fr, xuto...@inria.fr, yunb...@smu.edu.sg, ratna...@smu.edu.sg, Kexin Sun
The function kmalloc_large() was renamed kmalloc_large_noprof() by
commit 7bd230a26648 ("mm/slab: enable slab allocation tagging for
kmalloc and friends"), and subsequently renamed __kmalloc_large_noprof()
by commit a0a44d9175b3 ("mm, slab: don't wrap internal functions with
alloc_hooks()"), making it an internal implementation detail.

Large kmalloc allocations are now performed through the public kmalloc()
interface directly, making the reference to KMALLOC_MAX_SIZE also stale
(KMALLOC_MAX_CACHE_SIZE would be more accurate). Remove the references
to kmalloc_large() and KMALLOC_MAX_SIZE, and rephrase the description
for large kmalloc allocations.

Suggested-by: Andrey Ryabinin <ryabin...@gmail.com>
Assisted-by: unnamed:deepseek-v3.2 coccinelle
Signed-off-by: Kexin Sun <kexi...@smail.nju.edu.cn>
---
include/linux/kasan.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/linux/kasan.h b/include/linux/kasan.h
index 338a1921a50a..bf233bde68c7 100644
--- a/include/linux/kasan.h
+++ b/include/linux/kasan.h
@@ -352,8 +352,8 @@ bool __kasan_mempool_poison_object(void *ptr, unsigned long ip);
* kasan_mempool_unpoison_object().
*
* This function operates on all slab allocations including large kmalloc
- * allocations (the ones returned by kmalloc_large() or by kmalloc() with the
- * size > KMALLOC_MAX_SIZE).
+ * allocations (i.e. the ones backed directly by the buddy allocator rather
+ * than kmalloc slab caches).
*
* Return: true if the allocation can be safely reused; false otherwise.
*/
@@ -381,8 +381,8 @@ void __kasan_mempool_unpoison_object(void *ptr, size_t size, unsigned long ip);
* original tags based on the pointer value.
*
* This function operates on all slab allocations including large kmalloc
- * allocations (the ones returned by kmalloc_large() or by kmalloc() with the
- * size > KMALLOC_MAX_SIZE).
+ * allocations (i.e. the ones backed directly by the buddy allocator rather
+ * than kmalloc slab caches).

Andrey Ryabinin

unread,
Mar 12, 2026, 12:07:47 PM (9 days ago) Mar 12
to Kexin Sun, kasa...@googlegroups.com, gli...@google.com, andre...@gmail.com, dvy...@google.com, vincenzo...@arm.com, linux-...@vger.kernel.org, julia....@inria.fr, xuto...@inria.fr, yunb...@smu.edu.sg, ratna...@smu.edu.sg, ak...@linux-foundation.org
Kexin Sun <kexi...@smail.nju.edu.cn> writes:

> The function kmalloc_large() was renamed kmalloc_large_noprof() by
> commit 7bd230a26648 ("mm/slab: enable slab allocation tagging for
> kmalloc and friends"), and subsequently renamed __kmalloc_large_noprof()
> by commit a0a44d9175b3 ("mm, slab: don't wrap internal functions with
> alloc_hooks()"), making it an internal implementation detail.
>
> Large kmalloc allocations are now performed through the public kmalloc()
> interface directly, making the reference to KMALLOC_MAX_SIZE also stale
> (KMALLOC_MAX_CACHE_SIZE would be more accurate). Remove the references
> to kmalloc_large() and KMALLOC_MAX_SIZE, and rephrase the description
> for large kmalloc allocations.
>
> Suggested-by: Andrey Ryabinin <ryabin...@gmail.com>
> Assisted-by: unnamed:deepseek-v3.2 coccinelle
> Signed-off-by: Kexin Sun <kexi...@smail.nju.edu.cn>
> ---
> include/linux/kasan.h | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>

Reviewed-by: Andrey Ryabinin <ryabin...@gmail.com>
Reply all
Reply to author
Forward
0 new messages