From: tip-bot for Phillip Lougher <phillip@lougher.demon.co.uk>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, phillip@lougher.demon.co.uk,
hpa@zytor.com, mingo@redhat.com, tglx@linutronix.de
Subject: [tip:x86/urgent] bzip2/lzma/gzip: pre-boot malloc doesn't return NULL on failure
Date: Tue, 15 Dec 2009 22:57:38 GMT [thread overview]
Message-ID: <tip-c1e7c3ae59b065bf7ff24a05cb609b2f9e314db6@git.kernel.org> (raw)
In-Reply-To: <4b26b1ef.hIInb2AYPMtImAJO%phillip@lougher.demon.co.uk>
Commit-ID: c1e7c3ae59b065bf7ff24a05cb609b2f9e314db6
Gitweb: http://git.kernel.org/tip/c1e7c3ae59b065bf7ff24a05cb609b2f9e314db6
Author: Phillip Lougher <phillip@lougher.demon.co.uk>
AuthorDate: Mon, 14 Dec 2009 21:45:19 +0000
Committer: H. Peter Anvin <hpa@zytor.com>
CommitDate: Tue, 15 Dec 2009 14:04:12 -0800
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>
---
include/linux/decompress/mm.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/decompress/mm.h b/include/linux/decompress/mm.h
index 12ff8c3..5032b9a 100644
--- a/include/linux/decompress/mm.h
+++ b/include/linux/decompress/mm.h
@@ -25,7 +25,7 @@ static void *malloc(int size)
void *p;
if (size < 0)
- error("Malloc error");
+ return NULL;
if (!malloc_ptr)
malloc_ptr = free_mem_ptr;
@@ -35,7 +35,7 @@ static void *malloc(int size)
malloc_ptr += size;
if (free_mem_end_ptr && malloc_ptr >= free_mem_end_ptr)
- error("Out of memory");
+ return NULL;
malloc_count++;
return p;
prev parent reply other threads:[~2009-12-15 22:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-14 21:45 [PATCH 1/3] " Phillip Lougher
2009-12-15 22:57 ` tip-bot for Phillip Lougher [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-c1e7c3ae59b065bf7ff24a05cb609b2f9e314db6@git.kernel.org \
--to=phillip@lougher.demon.co.uk \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®