Skip to content

Commit

Permalink
ARM: zImage: don't ignore error returned from decompress()
Browse files Browse the repository at this point in the history
If decompress() returns an error without calling error(), we must
not attempt to boot the resulting kernel.

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
Tested-by: Shawn Guo <shawn.guo@linaro.org>
Tested-by: Tony Lindgren <tony@atomide.com>
  • Loading branch information
Nicolas Pitre authored and Nicolas Pitre committed May 7, 2011
1 parent e40f1e9 commit ccc1c7c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions arch/arm/boot/compressed/decompress.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ extern void error(char *);
#include "../../../../lib/decompress_unlzma.c"
#endif

void do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x))
int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x))
{
decompress(input, len, NULL, NULL, output, NULL, error);
return decompress(input, len, NULL, NULL, output, NULL, error);
}
13 changes: 9 additions & 4 deletions arch/arm/boot/compressed/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,16 @@ asmlinkage void __div0(void)
error("Attempting division by 0!");
}

extern void do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x));
extern int do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x));


void
decompress_kernel(unsigned long output_start, unsigned long free_mem_ptr_p,
unsigned long free_mem_ptr_end_p,
int arch_id)
{
int ret;

output_data = (unsigned char *)output_start;
free_mem_ptr = free_mem_ptr_p;
free_mem_end_ptr = free_mem_ptr_end_p;
Expand All @@ -193,7 +195,10 @@ decompress_kernel(unsigned long output_start, unsigned long free_mem_ptr_p,
arch_decomp_setup();

putstr("Uncompressing Linux...");
do_decompress(input_data, input_data_end - input_data,
output_data, error);
putstr(" done, booting the kernel.\n");
ret = do_decompress(input_data, input_data_end - input_data,
output_data, error);
if (ret)
error("decompressor returned an error");
else
putstr(" done, booting the kernel.\n");
}

0 comments on commit ccc1c7c

Please sign in to comment.