Commit d6d21dfd authored by Darren Jenkins's avatar Darren Jenkins Committed by Linus Torvalds

[PATCH] fix array overrun in efi.c

Coverity found an over-run @ line 364 of efi.c

This is due to the loop checking the size correctly, then adding a '\0'
after possibly hitting the end of the array.

Ensure the loop exits with one space left in the array.
Signed-off-by: default avatarDarren Jenkins <darrenrjenkins@gmail.com>
Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 3ac8bf07
...@@ -361,7 +361,7 @@ void __init efi_init(void) ...@@ -361,7 +361,7 @@ void __init efi_init(void)
*/ */
c16 = (efi_char16_t *) boot_ioremap(efi.systab->fw_vendor, 2); c16 = (efi_char16_t *) boot_ioremap(efi.systab->fw_vendor, 2);
if (c16) { if (c16) {
for (i = 0; i < sizeof(vendor) && *c16; ++i) for (i = 0; i < (sizeof(vendor) - 1) && *c16; ++i)
vendor[i] = *c16++; vendor[i] = *c16++;
vendor[i] = '\0'; vendor[i] = '\0';
} else } else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment