aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/decompress/mm.h
diff options
context:
space:
mode:
authorPhillip Lougher <phillip@lougher.demon.co.uk>2009-12-14 16:45:19 -0500
committerH. Peter Anvin <hpa@zytor.com>2009-12-15 17:04:12 -0500
commitc1e7c3ae59b065bf7ff24a05cb609b2f9e314db6 (patch)
treeb75700eb5160c026761f20e74010406a7fe58bec /include/linux/decompress/mm.h
parent23637568ad0c9b5ab0ad27d2f2f26d1e9282c527 (diff)
bzip2/lzma/gzip: pre-boot malloc doesn't return NULL on failure
The trivial malloc implementation used in the pre-boot environment by the decompressors returns a bad pointer on failure (falling through after calling error). This is doubly wrong - the callers expect malloc to return NULL on failure, second the error function is intended to be used by the decompressors to propagate errors to *their* callers. The decompressors have no access to any state set by the error function. Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk> LKML-Reference: <4b26b1ef.hIInb2AYPMtImAJO%phillip@lougher.demon.co.uk> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'include/linux/decompress/mm.h')
-rw-r--r--include/linux/decompress/mm.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/decompress/mm.h b/include/linux/decompress/mm.h
index 12ff8c3f1d05..5032b9a31ae7 100644
--- a/include/linux/decompress/mm.h
+++ b/include/linux/decompress/mm.h
@@ -25,7 +25,7 @@ static void *malloc(int size)
25 void *p; 25 void *p;
26 26
27 if (size < 0) 27 if (size < 0)
28 error("Malloc error"); 28 return NULL;
29 if (!malloc_ptr) 29 if (!malloc_ptr)
30 malloc_ptr = free_mem_ptr; 30 malloc_ptr = free_mem_ptr;
31 31
@@ -35,7 +35,7 @@ static void *malloc(int size)
35 malloc_ptr += size; 35 malloc_ptr += size;
36 36
37 if (free_mem_end_ptr && malloc_ptr >= free_mem_end_ptr) 37 if (free_mem_end_ptr && malloc_ptr >= free_mem_end_ptr)
38 error("Out of memory"); 38 return NULL;
39 39
40 malloc_count++; 40 malloc_count++;
41 return p; 41 return p;