diff --git a/mm/slab.h b/mm/slab.h index 620ceeddbe1ad74cfa5fb7bc5e2fc2d13f7e3191..a535033f7e9a153dfa7252dbb0d74f7be5ae4e58 100644 --- a/mm/slab.h +++ b/mm/slab.h @@ -162,6 +162,8 @@ static inline const char *cache_name(struct kmem_cache *s) static inline struct kmem_cache *cache_from_memcg(struct kmem_cache *s, int idx) { + if (!s->memcg_params) + return NULL; return s->memcg_params->memcg_caches[idx]; }