From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11199 invoked by alias); 6 Mar 2009 00:28:46 -0000 Received: (qmail 11188 invoked by uid 22791); 6 Mar 2009 00:28:45 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=BAYES_00,SPF_NEUTRAL X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 06 Mar 2009 00:28:40 +0000 Received: (qmail 3958 invoked from network); 6 Mar 2009 00:28:38 -0000 Received: from unknown (HELO orlando) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 6 Mar 2009 00:28:38 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [commit/Tru64] bring back the Tru64 port to life... Date: Fri, 06 Mar 2009 00:28:00 -0000 User-Agent: KMail/1.9.10 Cc: Joel Brobecker References: <20090305235503.GK3793@adacore.com> In-Reply-To: <20090305235503.GK3793@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200903060028.40871.alves.ped@gmail.com> 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 Mail-Followup-To: gdb-patches@sourceware.org X-SW-Source: 2009-03/txt/msg00072.txt.bz2 Not knowing a thing about tru64 or osf, On Thursday 05 March 2009 23:55:03, Joel Brobecker wrote: > =A0 =A0/* Allocate section space. =A0*/ > - =A0so->lm_info =3D xmalloc ((unsigned) &(((struct lm_info *)0)->secs) + > -=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 ns= ecs * sizeof *so->lm_info); > + =A0so->lm_info =3D xmalloc (sizeof (struct lm_info) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 + (nsecs - 1) * sizeof = (struct lm_sec)); Can nsecs be 0 here? Since it is checked at least here: static void osf_relocate_section_addresses (struct so_list *so, struct section_table *sec) { (...) if (lmi->nsecs && !lmi->secs[0].name) fetch_sec_names (lmi); If, so, you'll allocate less memory than you want in that case. --=20 Pedro Alves