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