From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5696 invoked by alias); 28 Feb 2012 08:17:53 -0000 Received: (qmail 5680 invoked by uid 22791); 28 Feb 2012 08:17:51 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 28 Feb 2012 08:17:26 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q1S8HP6r012595 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 28 Feb 2012 03:17:26 -0500 Received: from host2.jankratochvil.net (ovpn-116-19.ams2.redhat.com [10.36.116.19]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q1S8HKZv023049 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO) for ; Tue, 28 Feb 2012 03:17:24 -0500 Date: Tue, 28 Feb 2012 08:41:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [obv] cppcheck: microblaze-tdep.c uninitialized var Message-ID: <20120228081720.GA1835@host2.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-02/txt/msg00646.txt.bz2 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 + + 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 Nathan Froyd Maciej W. Rozycki --- 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. */