diff --git a/mm/slub.c b/mm/slub.c index ad44734dbf72a75146c5c8d67c8fb3b32c14ecee..ec1c3a376d3678aab2c29654de911f4dd243e257 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -5622,7 +5622,8 @@ static char *create_unique_id(struct kmem_cache *s) char *name = kmalloc(ID_STR_LENGTH, GFP_KERNEL); char *p = name; - BUG_ON(!name); + if (!name) + return ERR_PTR(-ENOMEM); *p++ = ':'; /* @@ -5680,6 +5681,8 @@ static int sysfs_slab_add(struct kmem_cache *s) * for the symlinks. */ name = create_unique_id(s); + if (IS_ERR(name)) + return PTR_ERR(name); } s->kobj.kset = kset;