[PATCH 6/10] Remove MAX_HEADERS check

Anton Blanchard anton at samba.org
Sun Apr 11 14:05:21 EST 2010


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 <anton at samba.org>
---

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");


More information about the Yaboot-devel mailing list