From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 102850 invoked by alias); 24 Feb 2019 14:16:13 -0000 Mailing-List: contact elfutils-devel-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: elfutils-devel-owner@sourceware.org Received: (qmail 102827 invoked by uid 89); 24 Feb 2019 14:16:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.2 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS,T_FILL_THIS_FORM_SHORT autolearn=ham version=3.3.2 spammy=deduce, HContent-Transfer-Encoding:8bit X-Spam-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS,T_FILL_THIS_FORM_SHORT autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: gnu.wildebeest.org Received: from wildebeest.demon.nl (HELO gnu.wildebeest.org) (212.238.236.112) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 24 Feb 2019 14:16:11 +0000 Received: from librem.wildebeest.org (unknown [188.207.107.47]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 97D7A302BB43; Sun, 24 Feb 2019 15:16:08 +0100 (CET) Received: by librem.wildebeest.org (Postfix, from userid 1000) id 4DCB213FFE4; Sun, 24 Feb 2019 15:11:59 +0100 (CET) From: Mark Wielaard To: elfutils-devel@sourceware.org Cc: Mark Wielaard Subject: [PATCH] libdwf: Initialize notes early in intuit_kernel_bounds. Date: Sun, 24 Feb 2019 14:16:00 -0000 Message-Id: <20190224141152.56436-1-mark@klomp.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Flag: NO X-IsSubscribed: yes X-SW-Source: 2019-q1/txt/msg00166.txt.bz2 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 --- 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 + + * 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 * 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