Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: jan.kratochvil@redhat.com
Cc: gdb-patches@sourceware.org, arnez@linux.vnet.ibm.com
Subject: Re: [commit] [patch] Fix solib list reading asan error (for PR 8882)
Date: Thu, 27 Feb 2014 20:56:00 -0000	[thread overview]
Message-ID: <201402272056.s1RKufPE026880@glazunov.sibelius.xs4all.nl> (raw)
In-Reply-To: <20140227201731.GA18067@host2.jankratochvil.net> (message from	Jan Kratochvil on Thu, 27 Feb 2014 21:17:31 +0100)

> Date: Thu, 27 Feb 2014 21:17:31 +0100
> From: Jan Kratochvil <jan.kratochvil@redhat.com>
> 
> On Wed, 26 Feb 2014 23:09:18 +0100, Jan Kratochvil wrote:
> > gdb/
> > 2014-02-26  Jan Kratochvil  <jan.kratochvil@redhat.com>
> > 
> > 	Additional PR 8882 fix.
> > 	* solib-svr4.c (svr4_read_so_list): Change first to first_l_name.
> 
> Checked in already as it is complicating the testing under asan:
> 	c91550fc5d8dae5f1140bca649690fa13e5276e9

Broke my build because ithe compiler warned that first_l_name may be
used uninitialized.  And I agree, so I committed the diff below as
obvious.

From c725e7b6878220bbeac44b86a2581d74f16b497c Mon Sep 17 00:00:00 2001
From: Mark Kettenis <kettenis@gnu.org>
Date: Thu, 27 Feb 2014 21:51:08 +0100
Subject: [PATCH] Prevent compiler warning.

GCC 4.2.1 complains about first_l_name may be used uninitialized, and my brain
agrees.

gdb/ChangeLog:

        * solib-svr4.c (svr4_read_so_list): Initialize first_l_name to 0.
---
 gdb/ChangeLog    | 4 ++++
 gdb/solib-svr4.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6a8fc0c..c99510c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
 2014-02-27  Mark Kettenis  <kettenis@gnu.org>
 
+	* solib-svr4.c (svr4_read_so_list): Initialize first_l_name to 0.
+
+2014-02-27  Mark Kettenis  <kettenis@gnu.org>
+
 	* sparc-nat.c (sparc_xfer_wcookie): Always use process ID.
 
 2014-02-27  Jan Kratochvil  <jan.kratochvil@redhat.com>
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 6c4dff7..4c94f9f 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -1306,7 +1306,7 @@ static int
 svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm,
 		   struct so_list ***link_ptr_ptr, int ignore_first)
 {
-  CORE_ADDR first_l_name;
+  CORE_ADDR first_l_name = 0;
   CORE_ADDR next_lm;
 
   for (; lm != 0; prev_lm = lm, lm = next_lm)
-- 
1.8.5.3



  reply	other threads:[~2014-02-27 20:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-26 22:09 Jan Kratochvil
2014-02-27 20:17 ` [commit] " Jan Kratochvil
2014-02-27 20:56   ` Mark Kettenis [this message]
2014-02-27 20:58     ` Jan Kratochvil

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=201402272056.s1RKufPE026880@glazunov.sibelius.xs4all.nl \
    --to=mark.kettenis@xs4all.nl \
    --cc=arnez@linux.vnet.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    /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