From patchwork Sun Apr 11 04:05:21 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Blanchard X-Patchwork-Id: 57972 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bilbo.ozlabs.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.3.1 X-Original-To: tony@bakeyournoodle.com Delivered-To: tony@bilbo.ozlabs.org Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 09D0EB7D8D for ; Sun, 11 Apr 2010 18:48:35 +1000 (EST) Received: by ozlabs.org (Postfix, from userid 1010) id EBF2CB7D1E; Sun, 11 Apr 2010 14:07:30 +1000 (EST) Date: Sun, 11 Apr 2010 14:05:21 +1000 From: Anton Blanchard To: yaboot-devel@lists.ozlabs.org Subject: [PATCH 6/10] Remove MAX_HEADERS check Message-ID: <20100411040521.GC11751@kryten> References: <20100411040149.GA3142@kryten> <20100411040226.GB3142@kryten> <20100411040256.GC3142@kryten> <20100411040321.GD3142@kryten> <20100411040427.GA11751@kryten> <20100411040448.GB11751@kryten> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20100411040448.GB11751@kryten> User-Agent: Mutt/1.5.20 (2009-06-14) X-Mailman-Approved-At: Sun, 11 Apr 2010 18:48:32 +1000 X-BeenThere: yaboot-devel@lists.ozlabs.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Technical and development discussion regarding yaboot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: yaboot-devel-bounces+tony=bakeyournoodle.com@lists.ozlabs.org Errors-To: yaboot-devel-bounces+tony=bakeyournoodle.com@lists.ozlabs.org Content-Length: 1523 Lines: 49 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");