diff options
| author | Alexei Starovoitov <ast@kernel.org> | 2025-07-18 12:14:51 -0700 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2025-07-18 12:15:59 -0700 |
| commit | beb1097ec8bdf15e2fed3301920a719e0dd2250a (patch) | |
| tree | 026a9569edbac6e1387a0cd9d7574e8b74795c05 /lib/alloc_tag.c | |
| parent | libbpf: Fix warning in calloc() usage (diff) | |
| parent | Merge tag 'pmdomain-v6.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/g... (diff) | |
| download | linux-beb1097ec8bdf15e2fed3301920a719e0dd2250a.tar.gz linux-beb1097ec8bdf15e2fed3301920a719e0dd2250a.zip | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf after rc6
Cross-merge BPF and other fixes after downstream PR.
No conflicts.
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'lib/alloc_tag.c')
| -rw-r--r-- | lib/alloc_tag.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/alloc_tag.c b/lib/alloc_tag.c index d48b80f3f007..0142bc916f73 100644 --- a/lib/alloc_tag.c +++ b/lib/alloc_tag.c @@ -10,6 +10,7 @@ #include <linux/seq_buf.h> #include <linux/seq_file.h> #include <linux/vmalloc.h> +#include <linux/kmemleak.h> #define ALLOCINFO_FILE_NAME "allocinfo" #define MODULE_ALLOC_TAG_VMAP_SIZE (100000UL * sizeof(struct alloc_tag)) @@ -134,6 +135,9 @@ size_t alloc_tag_top_users(struct codetag_bytes *tags, size_t count, bool can_sl struct codetag_bytes n; unsigned int i, nr = 0; + if (IS_ERR_OR_NULL(alloc_tag_cttype)) + return 0; + if (can_sleep) codetag_lock_module_list(alloc_tag_cttype, true); else if (!codetag_trylock_module_list(alloc_tag_cttype)) @@ -632,8 +636,13 @@ static int load_module(struct module *mod, struct codetag *start, struct codetag mod->name); return -ENOMEM; } - } + /* + * Avoid a kmemleak false positive. The pointer to the counters is stored + * in the alloc_tag section of the module and cannot be directly accessed. + */ + kmemleak_ignore_percpu(tag->counters); + } return 0; } |
