summaryrefslogtreecommitdiffstats
path: root/libdwfl/linux-kernel-modules.c
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2019-02-03 19:03:26 +0100
committerMark Wielaard <[email protected]>2019-02-28 22:19:03 +0100
commit92ded1f11c0622cd9e1943bb85e1bdbdc4fb4802 (patch)
tree36e86e70cd9273813142b7b0ff85d13a2b8542e8 /libdwfl/linux-kernel-modules.c
parentff7fe986679b0811591ef6e40cf485fa9f037e07 (diff)
libdwfl: Initialize notes early in intuit_kernel_bounds.
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 <[email protected]>
Diffstat (limited to 'libdwfl/linux-kernel-modules.c')
-rw-r--r--libdwfl/linux-kernel-modules.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c
index 360e4ee9..d46ab5aa 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, &notes);
if (result == 0)
{