public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch]: Check  __gthread_setspecific return
@ 2014-12-02 17:56 Ryan Mansfield
  2014-12-05 22:53 ` Jeff Law
  0 siblings, 1 reply; 3+ messages in thread
From: Ryan Mansfield @ 2014-12-02 17:56 UTC (permalink / raw)
  To: gcc-patches

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

Hi,

Underlying pthread_setspecific can return non-zero with ENOMEM or EINVAL.

2014-12-02  Ryan Mansfield  <rmansfield@qnx.com>

         * emutls.c (__emutls_get_address): Check __gthread_setspecific 
returns.

OK?

Regards,

Ryan Mansfield


[-- Attachment #2: emutls.c.diff --]
[-- Type: text/x-patch, Size: 763 bytes --]

Index: libgcc/emutls.c
===================================================================
--- libgcc/emutls.c	(revision 218278)
+++ libgcc/emutls.c	(working copy)
@@ -160,7 +160,8 @@
       if (arr == NULL)
 	abort ();
       arr->size = size;
-      __gthread_setspecific (emutls_key, (void *) arr);
+      if (__gthread_setspecific (emutls_key, (void *) arr) != 0)
+	abort ();
     }
   else if (__builtin_expect (offset > arr->size, 0))
     {
@@ -174,7 +175,8 @@
       arr->size = size;
       memset (arr->data + orig_size, 0,
 	      (size - orig_size) * sizeof (void *));
-      __gthread_setspecific (emutls_key, (void *) arr);
+      if (__gthread_setspecific (emutls_key, (void *) arr) != 0)
+	abort ();
     }
 
   void *ret = arr->data[offset - 1];

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

* Re: [Patch]: Check  __gthread_setspecific return
  2014-12-02 17:56 [Patch]: Check __gthread_setspecific return Ryan Mansfield
@ 2014-12-05 22:53 ` Jeff Law
  2014-12-12 19:43   ` Ryan Mansfield
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Law @ 2014-12-05 22:53 UTC (permalink / raw)
  To: Ryan Mansfield, gcc-patches

On 12/02/14 10:53, Ryan Mansfield wrote:
> Hi,
>
> Underlying pthread_setspecific can return non-zero with ENOMEM or EINVAL.
>
> 2014-12-02  Ryan Mansfield  <rmansfield@qnx.com>
>
>          * emutls.c (__emutls_get_address): Check __gthread_setspecific
> returns.
>
> OK?
OK.

Sorry for the delay,
Jeff

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

* Re: [Patch]: Check  __gthread_setspecific return
  2014-12-05 22:53 ` Jeff Law
@ 2014-12-12 19:43   ` Ryan Mansfield
  0 siblings, 0 replies; 3+ messages in thread
From: Ryan Mansfield @ 2014-12-12 19:43 UTC (permalink / raw)
  To: Jeff Law, gcc-patches

On 14-12-05 05:53 PM, Jeff Law wrote:
> On 12/02/14 10:53, Ryan Mansfield wrote:
>> Hi,
>>
>> Underlying pthread_setspecific can return non-zero with ENOMEM or EINVAL.
>>
>> 2014-12-02  Ryan Mansfield  <rmansfield@qnx.com>
>>
>>          * emutls.c (__emutls_get_address): Check __gthread_setspecific
>> returns.
>>
>> OK?
> OK.

Thanks Jeff. Could someone please apply on my behalf?

Regards,

Ryan Mansfield

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

end of thread, other threads:[~2014-12-12 19:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-02 17:56 [Patch]: Check __gthread_setspecific return Ryan Mansfield
2014-12-05 22:53 ` Jeff Law
2014-12-12 19:43   ` Ryan Mansfield

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