Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Convert jffs2 acl to struct_size

Need to tell the compiler that the acl entries follow the acl header.

Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
Signed-off-by: Kees Cook <keescook@chromium.org>

authored by

Matthew Wilcox and committed by
Kees Cook
a3ac9730 b2303d7b

+3 -1
+2 -1
fs/jffs2/acl.c
··· 133 133 size_t i; 134 134 135 135 *size = jffs2_acl_size(acl->a_count); 136 - header = kmalloc(sizeof(*header) + acl->a_count * sizeof(*entry), GFP_KERNEL); 136 + header = kmalloc(struct_size(header, a_entries, acl->a_count), 137 + GFP_KERNEL); 137 138 if (!header) 138 139 return ERR_PTR(-ENOMEM); 139 140 header->a_version = cpu_to_je32(JFFS2_ACL_VERSION);
+1
fs/jffs2/acl.h
··· 22 22 23 23 struct jffs2_acl_header { 24 24 jint32_t a_version; 25 + struct jffs2_acl_entry a_entries[]; 25 26 }; 26 27 27 28 #ifdef CONFIG_JFFS2_FS_POSIX_ACL