From ad0d7633bc9d18d752423d0cf47096e39bd4d0f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=BE=D1=80=D0=BE=D0=BB=D0=B5=D0=B2=20=D0=A1=D0=B5?= =?UTF-8?q?=D1=80=D0=B3=D0=B5=D0=B9?= Date: Wed, 11 May 2016 22:36:25 +0300 Subject: [PATCH] dwarf: check maps_init result This fixes GCC 4.9.3 warnings (Linux/mipsel): dwarf/Gfind_proc_info-lsb.c: In function 'locate_debug_info': dwarf/Gfind_proc_info-lsb.c:244:23: warning: 'mi.buf_end' may be used uninitialized in this function [-Wmaybe-uninitialized] struct map_iterator mi; ^ dwarf/Gfind_proc_info-lsb.c:244:23: warning: 'mi.buf' may be used uninitialized in this function [-Wmaybe-uninitialized] In file included from dwarf/Gfind_proc_info-lsb.c:46:0: ./os-linux.h:292:27: warning: 'mi.buf_size' may be used uninitialized in this function [-Wmaybe-uninitialized] munmap (mi->buf_end - mi->buf_size, mi->buf_size); ^ dwarf/Gfind_proc_info-lsb.c:244:23: note: 'mi.buf_size' was declared here struct map_iterator mi; ^ --- src/dwarf/Gfind_proc_info-lsb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/dwarf/Gfind_proc_info-lsb.c b/src/dwarf/Gfind_proc_info-lsb.c index 6e1f4c3f..0996e7fc 100644 --- a/src/dwarf/Gfind_proc_info-lsb.c +++ b/src/dwarf/Gfind_proc_info-lsb.c @@ -246,7 +246,9 @@ find_binary_for_address (unw_word_t ip, char *name, size_t name_size) int pid = getpid (); unsigned long segbase, mapoff, hi; - maps_init (&mi, pid); + if (maps_init (&mi, pid) != 0) + return 1; + while (maps_next (&mi, &segbase, &hi, &mapoff)) if (ip >= segbase && ip < hi) {