From: Anton Blanchard <anton@samba.org>
To: akpm@osdl.org
Cc: benh@kernel.crashing.org, paulus@samba.org, linux-kernel@vger.kernel.org
Subject: [PATCH] ppc64: fix some issues with mem_reserve
Date: Sat, 16 Oct 2004 15:03:34 +1000 [thread overview]
Message-ID: <20041016050334.GA4005@krispykreme.ozlabs.ibm.com> (raw)
Hi,
I found a couple of issues with reserve_mem:
- If we try and mem_reserve something of zero length, everything
reserved after it would get ignored. This is because early_reserve_mem
sees a zero length as a terminator.
- The code rounded the top down instead of up.
Signed-off-by: Anton Blanchard <anton@samba.org>
===== prom_init.c 1.2 vs edited =====
--- 1.2/arch/ppc64/kernel/prom_init.c 2004-09-27 19:12:49 +10:00
+++ edited/prom_init.c 2004-09-30 22:19:56 +10:00
@@ -587,17 +587,19 @@
static void reserve_mem(unsigned long base, unsigned long size)
{
unsigned long offset = reloc_offset();
- unsigned long top = base + size;
unsigned long cnt = RELOC(mem_reserve_cnt);
- /* We need to always keep one empty entry so that we
+ if (!size)
+ return;
+
+ base = _ALIGN_DOWN(base, PAGE_SIZE);
+ size = _ALIGN_UP(size, PAGE_SIZE);
+
+ /*
+ * We need to always keep one empty entry so that we
* have our terminator with "size" set to 0 since we are
* dumb and just copy this entire array to the boot params
*/
- base = _ALIGN_DOWN(base, PAGE_SIZE);
- top = _ALIGN_DOWN(top, PAGE_SIZE);
- size = top - base;
-
if (cnt >= (MEM_RESERVE_MAP_SIZE - 1))
prom_panic("Memory reserve map exhausted !\n");
RELOC(mem_reserve_map)[cnt].base = base;
reply other threads:[~2004-10-16 5:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20041016050334.GA4005@krispykreme.ozlabs.ibm.com \
--to=anton@samba.org \
--cc=akpm@osdl.org \
--cc=benh@kernel.crashing.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulus@samba.org \
/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®