diff mbox

: Check __gthread_setspecific return

Message ID 547DFC81.5080204@qnx.com
State New
Headers show

Commit Message

Ryan Mansfield Dec. 2, 2014, 5:53 p.m. UTC
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

Comments

Jeff Law Dec. 5, 2014, 10:53 p.m. UTC | #1
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
Ryan Mansfield Dec. 12, 2014, 7:43 p.m. UTC | #2
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
diff mbox

Patch

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];