From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: linux-kernel@vger.kernel.org, xen-devel@lists.xensource.com,
Ian.Campbell@citrix.com, hpa@zytor.com, x86@kernel.org
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: [PATCH 3/3] x86: Let extend_brk return a NULL pointer instead of just BUG_ON.
Date: Tue, 31 Jul 2012 06:42:56 -0400 [thread overview]
Message-ID: <1343731376-20658-4-git-send-email-konrad.wilk@oracle.com> (raw)
In-Reply-To: <1343731376-20658-1-git-send-email-konrad.wilk@oracle.com>
The callers of this function (dmi_alloc) and the various
Xen related ones can deal with a NULL pointer.
Suggested-by: Ian Campbell <Ian.Campbell@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
arch/x86/kernel/setup.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 16be6dc..13d6c51 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -268,9 +268,10 @@ void * __init extend_brk(size_t size, size_t align)
BUG_ON(_brk_start == 0);
BUG_ON(align & mask);
- _brk_end = (_brk_end + mask) & ~mask;
- BUG_ON((char *)(_brk_end + size) > __brk_limit);
+ if ((char *)(((_brk_end + mask) & ~mask) + size) > __brk_limit)
+ return NULL;
+ _brk_end = (_brk_end + mask) & ~mask;
ret = (void *)_brk_end;
_brk_end += size;
--
1.7.7.6
next prev parent reply other threads:[~2012-07-31 10:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-31 10:42 [PATCH] extend_brk and fixes to users of extend_brk (v1) Konrad Rzeszutek Wilk
2012-07-31 10:42 ` [PATCH 1/3] xen/mmu/p2m: Check extend_brk for NULL Konrad Rzeszutek Wilk
2012-07-31 13:48 ` Konrad Rzeszutek Wilk
2012-07-31 10:42 ` [PATCH 2/3] xen/p2m: Reserve 4MB of _brk space for P2M leafs when populating back Konrad Rzeszutek Wilk
2012-07-31 10:42 ` Konrad Rzeszutek Wilk [this message]
2012-07-31 15:49 ` [PATCH] extend_brk and fixes to users of extend_brk (v1) H. Peter Anvin
2012-07-31 16:15 ` Konrad Rzeszutek Wilk
2012-07-31 16:41 ` [Xen-devel] " Jan Beulich
2012-07-31 17:29 ` Konrad Rzeszutek Wilk
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=1343731376-20658-4-git-send-email-konrad.wilk@oracle.com \
--to=konrad.wilk@oracle.com \
--cc=Ian.Campbell@citrix.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xensource.com \
/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;
as well as URLs for NNTP newsgroup(s).