From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30582 invoked by alias); 28 Apr 2011 20:36:56 -0000 Received: (qmail 30533 invoked by uid 22791); 28 Apr 2011 20:36:55 -0000 X-SWARE-Spam-Status: No, hits=-6.9 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; Thu, 28 Apr 2011 20:36:36 +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 p3SKaZkx029956 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 28 Apr 2011 16:36:36 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p3SKaZZN011352; Thu, 28 Apr 2011 16:36:35 -0400 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p3SKaYKm031946; Thu, 28 Apr 2011 16:36:35 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 639393782ED; Thu, 28 Apr 2011 14:36:33 -0600 (MDT) From: Tom Tromey To: Binutils Development Subject: FYI: fix erroneous `sizeof' Date: Thu, 28 Apr 2011 20:36:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2011-04/txt/msg00430.txt.bz2 I am checking this in as obvious. A static analysis tool pointed out this bad `sizeof'. It seems clear that the intent is to zero out the whole struct stat, not just the first word of it. Tom 2011-04-28 Tom Tromey * bfdio.c (memory_bstat): Pass correct size to memset. Index: bfdio.c =================================================================== RCS file: /cvs/src/src/bfd/bfdio.c,v retrieving revision 1.27 diff -u -r1.27 bfdio.c --- bfdio.c 9 Jun 2010 13:28:31 -0000 1.27 +++ bfdio.c 28 Apr 2011 20:33:17 -0000 @@ -1,7 +1,7 @@ /* Low-level I/O routines for BFDs. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2011 Free Software Foundation, Inc. Written by Cygnus Support. @@ -577,7 +577,7 @@ { struct bfd_in_memory *bim = (struct bfd_in_memory *) abfd->iostream; - memset (statbuf, 0, sizeof (statbuf)); + memset (statbuf, 0, sizeof (*statbuf)); statbuf->st_size = bim->size; return 0;