This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: some more tidy-ups


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  <bje@au.ibm.com>

	* 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)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]