]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - lib/objagg.c
Merge branch 'enable-and-use-static_branch_deferred_inc'
[linux.git] / lib / objagg.c
index 576be22e86de8a2e9b738e91db34b3e4ef295a82..55621fb82e0a327f15e9c0394a9f817a28355ed7 100644 (file)
@@ -605,12 +605,10 @@ const struct objagg_stats *objagg_stats_get(struct objagg *objagg)
 {
        struct objagg_stats *objagg_stats;
        struct objagg_obj *objagg_obj;
-       size_t alloc_size;
        int i;
 
-       alloc_size = sizeof(*objagg_stats) +
-                    sizeof(objagg_stats->stats_info[0]) * objagg->obj_count;
-       objagg_stats = kzalloc(alloc_size, GFP_KERNEL);
+       objagg_stats = kzalloc(struct_size(objagg_stats, stats_info,
+                                          objagg->obj_count), GFP_KERNEL);
        if (!objagg_stats)
                return ERR_PTR(-ENOMEM);