summaryrefslogtreecommitdiff
path: root/tools/perf/python/stackcollapse.py
diff options
context:
space:
mode:
authorKees Cook <kees@kernel.org>2026-09-14 15:37:49 -0700
committerKees Cook <kees@kernel.org>2026-09-21 21:26:11 -0700
commit6e72cefa7a47f33fac62a69b22e02b379b7a754b (patch)
treed6393b417c9be9eca18df44d8bd6aa7efc28b10c /tools/perf/python/stackcollapse.py
parentb9f13e51ad1262dd77b1178c8011153894765c7b (diff)
downloadlinux-next-6e72cefa7a47f33fac62a69b22e02b379b7a754b.tar.gz
linux-next-6e72cefa7a47f33fac62a69b22e02b379b7a754b.zip
coccinelle: kmalloc_obj: Convert multi-byte integral allocations
Currently the kmalloc_obj conversion rules leave alone every allocation sized to an integral type, or assigned to a pointer to one, so that byte buffers keep being allocated with a byte count. That also leaves alone arrays of multi-byte integers, such as vals = kcalloc(n, sizeof(u32), GFP_KERNEL); which count objects like any other array. At the same time the signed types (s8 through s64 and their variants) were not in the list at all. But these multi-byte types are better handled through the full kmalloc_obj-style allocation, as they are, in fact, typed and aren't just a byte string, so they would benefit from type checking. Split INTEGRAL into BYTE_TYPES and MULTIBYTE_TYPES: - Allocations sized by a byte type or a string literal, or assigned to a pointer to a byte type, are still left alone. - Allocations sized by a multi-byte type are converted when they are assigned to a pointer, or a pointer to const, of that same type. Other allocations sized by a multi-byte type are left alone, as their target may be a pointer to an array. - Allocations of other types assigned to a pointer to a multi-byte type are still left alone. - Arrays of pointers to integral types sized by type, such as sizeof(char *), are still left alone, now including the signed types, as their target may be a pointer to an array of pointers, like "const char *(*fmts)[]". Sized as sizeof(*target), they are converted like any other array. List the signed types and the other spellings of the standard integer types (short int, unsigned, long long int, and so on), so that a declaration and a sizeof() that spell the same type differently still match. Assisted-by: LLM coccinelle Link: https://patch.msgid.link/20260914223748.i.971-kees@kernel.org Signed-off-by: Kees Cook <kees@kernel.org>
Diffstat (limited to 'tools/perf/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions