sparc: use struct_size() in kzalloc()
[linux-2.6-block.git] / arch / sparc / kernel / cpumap.c
index d1d52822603d0f036ad6b6b3b88c7f4b5d9d688c..1cb62bfeaa1ff8dd0777f2834991cc65d353fc99 100644 (file)
@@ -194,8 +194,7 @@ static struct cpuinfo_tree *build_cpuinfo_tree(void)
 
        n = enumerate_cpuinfo_nodes(tmp_level);
 
-       new_tree = kzalloc(sizeof(struct cpuinfo_tree) +
-                          (sizeof(struct cpuinfo_node) * n), GFP_ATOMIC);
+       new_tree = kzalloc(struct_size(new_tree, nodes, n), GFP_ATOMIC);
        if (!new_tree)
                return NULL;