public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [RFA] bfd/i386linux.c, linux_tally_symbols, Check for null return.
@ 2011-03-06 23:19 Michael Snyder
  2011-03-07  7:06 ` Alan Modra
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Snyder @ 2011-03-06 23:19 UTC (permalink / raw)
  To: gdb-patches, binutils, rth

[-- Attachment #1: Type: text/plain, Size: 104 bytes --]

linux_link_hash_lookup may return null.
Checked in 46 out of 53 instances, according to Coverity.

OK?


[-- Attachment #2: i386linux.txt --]
[-- Type: text/plain, Size: 827 bytes --]

2011-03-06  Michael Snyder  <msnyder@vmware.com>

	* i386linux.c (linux_tally_symbols): Check for null return.

Index: i386linux.c
===================================================================
RCS file: /cvs/src/src/bfd/i386linux.c,v
retrieving revision 1.23
diff -u -p -r1.23 i386linux.c
--- i386linux.c	2 Oct 2009 14:40:41 -0000	1.23
+++ i386linux.c	6 Mar 2011 23:13:55 -0000
@@ -491,7 +491,7 @@ linux_tally_symbols (h, data)
 	 use an indirect symbol to get to the real symbol, we add the
 	 fixup anyway, since there are cases where these symbols come
 	 from different shared libraries */
-      if (h1 != NULL
+      if (h1 != NULL && h2 != NULL
 	  && (((h1->root.root.type == bfd_link_hash_defined
 		|| h1->root.root.type == bfd_link_hash_defweak)
 	       && ! bfd_is_abs_section (h1->root.root.u.def.section))

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFA] bfd/i386linux.c, linux_tally_symbols, Check for null return.
  2011-03-06 23:19 [RFA] bfd/i386linux.c, linux_tally_symbols, Check for null return Michael Snyder
@ 2011-03-07  7:06 ` Alan Modra
  2011-03-07 18:43   ` Michael Snyder
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Modra @ 2011-03-07  7:06 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb-patches, binutils, rth

On Sun, Mar 06, 2011 at 03:18:52PM -0800, Michael Snyder wrote:
> Index: i386linux.c
> ===================================================================
> RCS file: /cvs/src/src/bfd/i386linux.c,v
> retrieving revision 1.23
> diff -u -p -r1.23 i386linux.c
> --- i386linux.c	2 Oct 2009 14:40:41 -0000	1.23
> +++ i386linux.c	6 Mar 2011 23:13:55 -0000
> @@ -491,7 +491,7 @@ linux_tally_symbols (h, data)
>  	 use an indirect symbol to get to the real symbol, we add the
>  	 fixup anyway, since there are cases where these symbols come
>  	 from different shared libraries */
> -      if (h1 != NULL
> +      if (h1 != NULL && h2 != NULL
>  	  && (((h1->root.root.type == bfd_link_hash_defined
>  		|| h1->root.root.type == bfd_link_hash_defweak)
>  	       && ! bfd_is_abs_section (h1->root.root.u.def.section))

h2 can't be NULL without h1 being NULL, so the patch isn't needed.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFA] bfd/i386linux.c, linux_tally_symbols, Check for null return.
  2011-03-07  7:06 ` Alan Modra
@ 2011-03-07 18:43   ` Michael Snyder
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Snyder @ 2011-03-07 18:43 UTC (permalink / raw)
  To: Michael Snyder, gdb-patches, binutils, rth

Alan Modra wrote:
> On Sun, Mar 06, 2011 at 03:18:52PM -0800, Michael Snyder wrote:
>> Index: i386linux.c
>> ===================================================================
>> RCS file: /cvs/src/src/bfd/i386linux.c,v
>> retrieving revision 1.23
>> diff -u -p -r1.23 i386linux.c
>> --- i386linux.c	2 Oct 2009 14:40:41 -0000	1.23
>> +++ i386linux.c	6 Mar 2011 23:13:55 -0000
>> @@ -491,7 +491,7 @@ linux_tally_symbols (h, data)
>>  	 use an indirect symbol to get to the real symbol, we add the
>>  	 fixup anyway, since there are cases where these symbols come
>>  	 from different shared libraries */
>> -      if (h1 != NULL
>> +      if (h1 != NULL && h2 != NULL
>>  	  && (((h1->root.root.type == bfd_link_hash_defined
>>  		|| h1->root.root.type == bfd_link_hash_defweak)
>>  	       && ! bfd_is_abs_section (h1->root.root.u.def.section))
> 
> h2 can't be NULL without h1 being NULL, so the patch isn't needed.
> 

OK, withdrawn

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-03-07 18:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-06 23:19 [RFA] bfd/i386linux.c, linux_tally_symbols, Check for null return Michael Snyder
2011-03-07  7:06 ` Alan Modra
2011-03-07 18:43   ` Michael Snyder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).