From patchwork Sun Apr 11 04:05:21 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [6/10] Remove MAX_HEADERS check From: Anton Blanchard X-Patchwork-Id: 57972 Message-Id: <20100411040521.GC11751@kryten> To: yaboot-devel@lists.ozlabs.org Date: Sun, 11 Apr 2010 14:05:21 +1000 The comparison against MAX_HEADERS doesn't match the error message and we are dynamically allocating memory for the program headers, so there should not be a limit. Signed-off-by: Anton Blanchard --- Index: yaboot/second/yaboot.c =================================================================== --- yaboot.orig/second/yaboot.c 2010-04-01 16:08:19.000000000 +1100 +++ yaboot/second/yaboot.c 2010-04-01 16:09:34.000000000 +1100 @@ -1008,8 +1008,6 @@ int get_params(struct boot_param_t* para void yaboot_text_ui(void) { -#define MAX_HEADERS 32 - struct boot_file_t file; int result; static struct boot_param_t params; @@ -1244,11 +1242,6 @@ load_elf32(struct boot_file_t *file, loa loadinfo->entry = e->e_entry; - if (e->e_phnum > MAX_HEADERS) { - prom_printf ("Can only load kernels with one program header\n"); - goto bail; - } - ph = (Elf32_Phdr *)malloc(sizeof(Elf32_Phdr) * e->e_phnum); if (!ph) { prom_printf ("Malloc error\n"); @@ -1382,11 +1375,6 @@ load_elf64(struct boot_file_t *file, loa loadinfo->entry = e->e_entry; - if (e->e_phnum > MAX_HEADERS) { - prom_printf ("Can only load kernels with one program header\n"); - goto bail; - } - ph = (Elf64_Phdr *)malloc(sizeof(Elf64_Phdr) * e->e_phnum); if (!ph) { prom_printf ("Malloc error\n");