Convert jffs2 acl to struct_size
[linux-2.6-microblaze.git] / fs / jffs2 / acl.c
index 7ebacf1..093ffbd 100644 (file)
@@ -133,7 +133,8 @@ static void *jffs2_acl_to_medium(const struct posix_acl *acl, size_t *size)
        size_t i;
 
        *size = jffs2_acl_size(acl->a_count);
-       header = kmalloc(sizeof(*header) + acl->a_count * sizeof(*entry), GFP_KERNEL);
+       header = kmalloc(struct_size(header, a_entries, acl->a_count),
+                       GFP_KERNEL);
        if (!header)
                return ERR_PTR(-ENOMEM);
        header->a_version = cpu_to_je32(JFFS2_ACL_VERSION);