Patchwork [6/10] Remove MAX_HEADERS check

login
register
mail settings
Submitter Anton Blanchard
Date April 11, 2010, 4:05 a.m.
Message ID <20100411040521.GC11751@kryten>
Download mbox | patch
Permalink /patch/57972/
State Changes Requested
Headers show

Comments

Anton Blanchard - April 11, 2010, 4:05 a.m.
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@samba.org>
---

Patch

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