This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[obv] cppcheck: microblaze-tdep.c uninitialized var
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Tue, 28 Feb 2012 09:17:20 +0100
- Subject: [obv] cppcheck: microblaze-tdep.c uninitialized var
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. */