From patchwork Sat Jun 11 20:48:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Baldwin X-Patchwork-Id: 12990 Received: (qmail 104526 invoked by alias); 11 Jun 2016 20:49:39 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 104443 invoked by uid 89); 11 Jun 2016 20:49:38 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.2 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=2.7.0 X-Spam-User: qpsmtpd, 2 recipients X-HELO: bigwig.baldwin.cx Received: from bigwig.baldwin.cx (HELO bigwig.baldwin.cx) (96.47.65.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Sat, 11 Jun 2016 20:49:27 +0000 Received: from ralph.baldwin.cx.net (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 9F7F3B9B3; Sat, 11 Jun 2016 16:49:25 -0400 (EDT) From: John Baldwin To: gdb-patches@sourceware.org, binutils@sourceware.org Subject: [PATCH 3/8] Initialize 'ra' to zero to avoid uninitialized use. Date: Sat, 11 Jun 2016 13:48:30 -0700 Message-Id: <1465678115-58170-4-git-send-email-jhb@FreeBSD.org> In-Reply-To: <1465678115-58170-1-git-send-email-jhb@FreeBSD.org> References: <1465678115-58170-1-git-send-email-jhb@FreeBSD.org> X-IsSubscribed: yes If the instruction in this case does not include an RA field, then 'ra' is used uninitialized. Use the same idiom used elsewhere in this file of initializing ra to zero before check for an RA field. gdb/ChangeLog: * rs6000-tdep.c (ppc_process_record_op31): Initialize ra. --- gdb/ChangeLog | 4 ++++ gdb/rs6000-tdep.c | 1 + 2 files changed, 5 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 335476b..38fcb30 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2016-06-11 John Baldwin + + * rs6000-tdep.c (ppc_process_record_op31): Initialize ra. + 2016-06-10 Tom Tromey * gdbtypes.c (arch_type, arch_integer_type, arch_character_type) diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 645fe92..1ed1354 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -4631,6 +4631,7 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache, || at_dcsz == 0) at_dcsz = 128; /* Assume 128-byte cache line size (POWER8) */ + ra = 0; if (PPC_RA (insn) != 0) regcache_raw_read_unsigned (regcache, tdep->ppc_gp0_regnum + PPC_RA (insn), &ra);