From: Mark Wielaard <mark@klomp.org>
To: elfutils-devel@sourceware.org
Cc: Mark Wielaard <mark@klomp.org>
Subject: [PATCH] libdwf: Initialize notes early in intuit_kernel_bounds.
Date: Sun, 24 Feb 2019 14:16:00 -0000 [thread overview]
Message-ID: <20190224141152.56436-1-mark@klomp.org> (raw)
We fake initialization of notes with an empty asm statement. But
it is simpler and less confusing to just initialize notes just
before the fopen.
Signed-off-by: Mark Wielaard <mark@klomp.org>
---
libdwfl/ChangeLog | 6 ++++++
libdwfl/linux-kernel-modules.c | 7 ++-----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 04cadb43c..95dc426b6 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -1,3 +1,9 @@
+2019-02-24 Mark Wielaard <mark@klomp.org>
+
+ * linux-kernel-modules.c (intuit_kernel_bounds): Init *notes before
+ fopen.
+ (dwfl_linux_kernel_report_kernel): Remove fake note init empty asm.
+
2019-01-25 Yonghong Song <yhs@fb.com>
* linux-proc-maps.c (proc_maps_report): Use PRIu64, not PRIi64, to
diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c
index 360e4ee93..d46ab5aa1 100644
--- a/libdwfl/linux-kernel-modules.c
+++ b/libdwfl/linux-kernel-modules.c
@@ -493,14 +493,14 @@ intuit_kernel_bounds (Dwarf_Addr *start, Dwarf_Addr *end, Dwarf_Addr *notes)
{
struct read_address_state state = { NULL, NULL, 0, 0, NULL, NULL };
+ *notes = 0;
+
state.f = fopen (KSYMSFILE, "r");
if (state.f == NULL)
return errno;
(void) __fsetlocking (state.f, FSETLOCKING_BYCALLER);
- *notes = 0;
-
int result;
do
result = read_address (&state, start) ? 0 : -1;
@@ -695,9 +695,6 @@ dwfl_linux_kernel_report_kernel (Dwfl *dwfl)
/* Try to figure out the bounds of the kernel image without
looking for any vmlinux file. */
Dwarf_Addr notes;
- /* The compiler cannot deduce that if intuit_kernel_bounds returns
- zero NOTES will be initialized. Fake the initialization. */
- asm ("" : "=m" (notes));
int result = intuit_kernel_bounds (&start, &end, ¬es);
if (result == 0)
{
--
2.20.1
next reply other threads:[~2019-02-24 14:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-24 14:16 Mark Wielaard [this message]
2019-02-28 21:21 ` Mark Wielaard
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=20190224141152.56436-1-mark@klomp.org \
--to=mark@klomp.org \
--cc=elfutils-devel@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).