diff options
author | Vlastimil Babka <vbabka@suse.cz> | 2022-09-29 11:27:58 +0200 |
---|---|---|
committer | Vlastimil Babka <vbabka@suse.cz> | 2022-09-29 11:27:58 +0200 |
commit | 0bdcef54a25b1990ab43cb58817731290b07dc50 (patch) | |
tree | e46e45fb3dd4401b18d3e65d0cac7c0ecd8e972c /mm/slub.c | |
parent | 5959725a4af615ba6c93c6466e1cc973f3979339 (diff) | |
parent | d65360f224069a6de56eb18e0425973914a10fe8 (diff) |
Merge branch 'slab/for-6.1/trivial' into slab/for-next
Additional cleanup by Chao Yu removing a BUG_ON() in create_unique_id().
Diffstat (limited to 'mm/slub.c')
-rw-r--r-- | mm/slub.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/mm/slub.c b/mm/slub.c index 5677988372b6..4aa18dd9c4e2 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -5751,7 +5751,7 @@ static inline struct kset *cache_kset(struct kmem_cache *s) return slab_kset; } -#define ID_STR_LENGTH 64 +#define ID_STR_LENGTH 32 /* Create a unique string id for a slab cache: * @@ -5785,9 +5785,12 @@ static char *create_unique_id(struct kmem_cache *s) *p++ = 'A'; if (p != name + 1) *p++ = '-'; - p += sprintf(p, "%07u", s->size); + p += snprintf(p, ID_STR_LENGTH - (p - name), "%07u", s->size); - BUG_ON(p > name + ID_STR_LENGTH - 1); + if (WARN_ON(p > name + ID_STR_LENGTH - 1)) { + kfree(name); + return ERR_PTR(-EINVAL); + } return name; } |