Merge tag 'tpmdd-next-20180323' of git://git.infradead.org/users/jjs/linux-tpmdd...
[linux-2.6-block.git] / fs / binfmt_elf.c
index 83732fef510d284032a16fb2f7b95c4f94ad1dd3..bdb201230bae93c408cf1972b6f9bb92ad37e478 100644 (file)
@@ -1599,6 +1599,8 @@ static int fill_files_note(struct memelfnote *note)
 
        /* *Estimated* file count and total data size needed */
        count = current->mm->map_count;
+       if (count > UINT_MAX / 64)
+               return -EINVAL;
        size = count * 64;
 
        names_ofs = (2 + 3 * count) * sizeof(data[0]);