Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Subject: [obv] cppcheck: microblaze-tdep.c uninitialized var
Date: Tue, 28 Feb 2012 08:41:00 -0000	[thread overview]
Message-ID: <20120228081720.GA1835@host2.jankratochvil.net> (raw)

Hi,

cppcheck complained
	[microblaze-tdep.c:565]: (error) Uninitialized variable: buf
and I find its complaint valid + obvious to fix, checked it in.

FYI I did not find any other cppcheck issue as valid in gdb/.


Thanks,
Jan


http://sourceware.org/ml/gdb-cvs/2012-02/msg00189.html

--- src/gdb/ChangeLog	2012/02/27 23:05:40	1.13874
+++ src/gdb/ChangeLog	2012/02/28 08:14:05	1.13875
@@ -1,3 +1,9 @@
+2012-02-28  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+	Fix static analysis issue found by cppcheck.
+	* microblaze-tdep.c (microblaze_extract_return_value): Fix
+	uninitialized BUF for size 2.
+
 2012-02-27  Chris Dearman  <chris@mips.com>
             Nathan Froyd  <froydnj@codesourcery.com>
             Maciej W. Rozycki  <macro@codesourcery.com>
--- src/gdb/microblaze-tdep.c	2012/02/02 20:19:16	1.8
+++ src/gdb/microblaze-tdep.c	2012/02/28 08:14:11	1.9
@@ -562,6 +562,7 @@
 	memcpy(valbuf, buf + MICROBLAZE_REGISTER_SIZE - 1, 1);
 	return;
       case 2:	/* return last 2 bytes in register.  */
+	regcache_cooked_read (regcache, MICROBLAZE_RETVAL_REGNUM, buf);
 	memcpy(valbuf, buf + MICROBLAZE_REGISTER_SIZE - 2, 2);
 	return;
       case 4:	/* for sizes 4 or 8, copy the required length.  */


             reply	other threads:[~2012-02-28  8:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-28  8:41 Jan Kratochvil [this message]
2012-02-28 16:04 ` Michael Eager

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=20120228081720.GA1835@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /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