kmalloc_array manages count*sizeof overflow.

Cc: Alexander Viro <[email protected]>
Cc: Andrew Morton <[email protected]>
Signed-off-by: Fabian Frederick <[email protected]>
---
 fs/binfmt_elf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index 3892c1a..49b1880 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1816,7 +1816,7 @@ static int elf_note_info_init(struct elf_note_info *info)
        INIT_LIST_HEAD(&info->thread_list);
 
        /* Allocate space for ELF notes */
-       info->notes = kmalloc(8 * sizeof(struct memelfnote), GFP_KERNEL);
+       info->notes = kmalloc_array(8, sizeof(struct memelfnote), GFP_KERNEL);
        if (!info->notes)
                return 0;
        info->psinfo = kmalloc(sizeof(*info->psinfo), GFP_KERNEL);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to