We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 5959725 + d65360f commit 0bdcef5Copy full SHA for 0bdcef5
mm/slub.c
@@ -5751,7 +5751,7 @@ static inline struct kset *cache_kset(struct kmem_cache *s)
5751
return slab_kset;
5752
}
5753
5754
-#define ID_STR_LENGTH 64
+#define ID_STR_LENGTH 32
5755
5756
/* Create a unique string id for a slab cache:
5757
*
@@ -5785,9 +5785,12 @@ static char *create_unique_id(struct kmem_cache *s)
5785
*p++ = 'A';
5786
if (p != name + 1)
5787
*p++ = '-';
5788
- p += sprintf(p, "%07u", s->size);
+ p += snprintf(p, ID_STR_LENGTH - (p - name), "%07u", s->size);
5789
5790
- BUG_ON(p > name + ID_STR_LENGTH - 1);
+ if (WARN_ON(p > name + ID_STR_LENGTH - 1)) {
5791
+ kfree(name);
5792
+ return ERR_PTR(-EINVAL);
5793
+ }
5794
return name;
5795
5796
0 commit comments