From: Robert Millan <rmh@aybabtu.com>
To: grub-devel@gnu.org
Subject: [PATCH] use of grub_dprintf in grub_mm_init_region() is misleading
Date: Wed, 23 Jan 2008 14:18:55 +0100 [thread overview]
Message-ID: <20080123131855.GA29373@thorin> (raw)
[-- Attachment #1: Type: text/plain, Size: 718 bytes --]
Using grub_dprintf() in grub_mm_init_region() easily leads to think that one
can activate this debug message by issuing `grub_env_set ("debug", "mem")' in
grub_machine_init(), before memory initialisation.
However, that's completely false. grub_env_set will silently [1] ignore your
call because grub_malloc() ain't usable, possibly making you think for a while
that no free memory was found, and that memory was not initialized at all!
I propose turning it into a disabled grub_printf().
[1] well, it'll return an error code. but who remembers about checking that?
--
Robert Millan
<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
[-- Attachment #2: mem_dprintf.diff --]
[-- Type: text/x-diff, Size: 694 bytes --]
* kern/mm.c (grub_mm_init_region): Replace grub_dprintf() call with
#ifdef'ed out grub_printf().
diff -x CVS -x '*~' -x '*.mk' -urp ../grub2/kern/mm.c ./kern/mm.c
--- ../grub2/kern/mm.c 2008-01-21 22:13:11.000000000 +0100
+++ ./kern/mm.c 2008-01-23 13:30:53.000000000 +0100
@@ -143,7 +143,9 @@ grub_mm_init_region (void *addr, grub_si
grub_mm_header_t h;
grub_mm_region_t r, *p, q;
- grub_dprintf ("mem", "Using memory for heap: start=%p, end=%p\n", addr, addr + (unsigned int) size);
+#if 0
+ grub_printf ("Using memory for heap: start=%p, end=%p\n", addr, addr + (unsigned int) size);
+#endif
/* If this region is too small, ignore it. */
if (size < GRUB_MM_ALIGN * 2)
next reply other threads:[~2008-01-23 13:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-23 13:18 Robert Millan [this message]
2008-01-23 13:53 ` [PATCH] use of grub_dprintf in grub_mm_init_region() is misleading Marco Gerards
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=20080123131855.GA29373@thorin \
--to=rmh@aybabtu.com \
--cc=grub-devel@gnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.