This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc 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]

[glibc/google/grte/v5-2.27/master] Remove an unneeded local refactor in _dl_update_slotinfo


https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=6572fe9303d555e001efbb86b5215e0cd5ce3004

commit 6572fe9303d555e001efbb86b5215e0cd5ce3004
Author: Stan Shebs <stanshebs@google.com>
Date:   Wed Oct 30 13:32:13 2019 -0700

    Remove an unneeded local refactor in _dl_update_slotinfo

Diff:
---
 elf/dl-tls.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/elf/dl-tls.c b/elf/dl-tls.c
index 4724209..67198f7 100644
--- a/elf/dl-tls.c
+++ b/elf/dl-tls.c
@@ -720,26 +720,25 @@ _dl_update_slotinfo (unsigned long int req_modid)
 	      if (gen <= dtv[0].counter)
 		continue;
 
-	      size_t modid = total + cnt;
-
 	      /* If there is no map this means the entry is empty.  */
 	      struct link_map *map = listp->slotinfo[cnt].map;
 	      if (map == NULL)
 		{
-		  if (dtv[-1].counter >= modid)
+		  if (dtv[-1].counter >= total + cnt)
 		    {
 		      /* If this modid was used at some point the memory
 			 might still be allocated.  */
-		      __signal_safe_free (dtv[modid].pointer.to_free);
-		      dtv[modid].pointer.val = TLS_DTV_UNALLOCATED;
-		      dtv[modid].pointer.to_free = NULL;
+		      __signal_safe_free (dtv[total + cnt].pointer.to_free);
+		      dtv[total + cnt].pointer.val = TLS_DTV_UNALLOCATED;
+		      dtv[total + cnt].pointer.to_free = NULL;
 		    }
 
 		  continue;
 		}
 
-	      assert (modid == map->l_tls_modid);
 	      /* Check whether the current dtv array is large enough.  */
+	      size_t modid = map->l_tls_modid;
+	      assert (total + cnt == modid);
 	      if (dtv[-1].counter < modid)
 		{
 		  /* Resize the dtv.  */


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