179894
commit 881b68e45c3a518319dcf5a3c4a2b3ec59e1c1e5
179894
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
179894
Date:   Fri Jul 16 08:32:05 2021 -0300
179894
179894
    elf: Fix a wrong array access on tst-tls20
179894
    
179894
    Check on x86_64-linux-gnu with --enable-stack-protector=all.
179894
179894
diff --git a/elf/tst-tls20.c b/elf/tst-tls20.c
179894
index d8d04fe574597f35..831c3336c914790d 100644
179894
--- a/elf/tst-tls20.c
179894
+++ b/elf/tst-tls20.c
179894
@@ -226,12 +226,12 @@ do_test_dependency (void)
179894
       int mods[nmods];
179894
       /* We use '0' as indication for a gap, to avoid the dlclose on iteration
179894
 	 cleanup.  */
179894
-      for (int n = 1; n <= nmods; n++)
179894
+      for (int n = 1; n < nmods; n++)
179894
 	{
179894
 	  load_mod (n);
179894
 	   mods[n] = n;
179894
 	}
179894
-      for (int n = 1; n <= nmods; n++)
179894
+      for (int n = 1; n < nmods; n++)
179894
 	{
179894
 	  if (!is_mod_set (g, n))
179894
 	    {
179894
@@ -304,12 +304,12 @@ do_test_invalid_dependency (bool bind_now)
179894
       int mods[nmods];
179894
       /* We use '0' as indication for a gap, to avoid the dlclose on iteration
179894
 	 cleanup.  */
179894
-      for (int n = 1; n <= nmods; n++)
179894
+      for (int n = 1; n < nmods; n++)
179894
 	{
179894
 	  load_mod (n);
179894
 	   mods[n] = n;
179894
 	}
179894
-      for (int n = 1; n <= nmods; n++)
179894
+      for (int n = 1; n < nmods; n++)
179894
 	{
179894
 	  if (!is_mod_set (g, n))
179894
 	    {