From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32224 invoked by alias); 9 May 2006 01:38:42 -0000 Received: (qmail 32213 invoked by uid 22791); 9 May 2006 01:38:41 -0000 X-Spam-Check-By: sourceware.org Received: from ausmtp04.au.ibm.com (HELO ausmtp04.au.ibm.com) (202.81.18.152) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 09 May 2006 01:38:38 +0000 Received: from sd0208e0.au.ibm.com (d23rh904.au.ibm.com [202.81.18.202]) by ausmtp04.au.ibm.com (8.13.6/8.13.5) with ESMTP id k491nHmV264306 for ; Tue, 9 May 2006 11:49:17 +1000 Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.250.244]) by sd0208e0.au.ibm.com (8.12.10/NCO/VER6.8) with ESMTP id k491frs6104128 for ; Tue, 9 May 2006 11:41:53 +1000 Received: from d23av03.au.ibm.com (loopback [127.0.0.1]) by d23av03.au.ibm.com (8.12.11/8.13.3) with ESMTP id k491cXLo029807 for ; Tue, 9 May 2006 11:38:33 +1000 Received: from ozlabs.au.ibm.com (ozlabs.au.ibm.com [9.190.163.12]) by d23av03.au.ibm.com (8.12.11/8.12.11) with ESMTP id k491cWaG029641 for ; Tue, 9 May 2006 11:38:33 +1000 Received: by ozlabs.au.ibm.com (Postfix, from userid 1017) id BA32973723; Tue, 9 May 2006 11:39:27 +1000 (EST) Date: Tue, 09 May 2006 04:30:00 -0000 From: Ben Elliston To: binutils@sourceware.org Subject: PATCH: some more tidy-ups Message-ID: <20060509013927.GA21460@ozlabs.au.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.6i Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2006-05/txt/msg00158.txt.bz2 A couple of more tidy-ups. My change to linker.c should now prevent the possibility of a segfault in BFD due to a null pointer dereference (well, at least, it at least pushes it up a level!) Tested with an all-targets build. Okay for mainline? 2006-05-09 Ben Elliston * linker.c (archive_hash_newfunc): Guard against a null return value from bfd_hash_newfunc. * elf64-ppc.c (ppc64_elf_finish_dynamic_symbol): Remove unused local variable `dynobj'. Index: linker.c =================================================================== RCS file: /cvs/src/src/bfd/linker.c,v retrieving revision 1.53 diff -u -p -r1.53 linker.c --- linker.c 16 Mar 2006 12:20:16 -0000 1.53 +++ linker.c 9 May 2006 01:34:46 -0000 @@ -886,13 +886,11 @@ archive_hash_newfunc (struct bfd_hash_en /* Call the allocation method of the superclass. */ ret = ((struct archive_hash_entry *) bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string)); + if (ret == NULL) + return NULL; - if (ret) - { - /* Initialize the local fields. */ - ret->defs = NULL; - } - + /* Initialize the local fields. */ + ret->defs = NULL; return &ret->root; } Index: elf64-ppc.c =================================================================== RCS file: /cvs/src/src/bfd/elf64-ppc.c,v retrieving revision 1.237 diff -u -p -r1.237 elf64-ppc.c --- elf64-ppc.c 5 May 2006 13:07:30 -0000 1.237 +++ elf64-ppc.c 9 May 2006 01:35:14 -0000 @@ -11102,13 +11102,11 @@ ppc64_elf_finish_dynamic_symbol (bfd *ou Elf_Internal_Sym *sym) { struct ppc_link_hash_table *htab; - bfd *dynobj; struct plt_entry *ent; Elf_Internal_Rela rela; bfd_byte *loc; htab = ppc_hash_table (info); - dynobj = htab->elf.dynobj; for (ent = h->plt.plist; ent != NULL; ent = ent->next) if (ent->plt.offset != (bfd_vma) -1)