Skip to contentSkip to conversation

Using the wrong variable in loop.

PATCH New René van Dorst 1 participant 1 message Feb 8, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Using the wrong variable in loop.

Fix compiler error:

WireGuard/src/crypto/../selftest/poly1305.h:1497:10: warning: iteration 35u invokes undefined behavior [-Waggressive-loop-optimizations]

   size_t inlen = poly1305_testvecs[i].input.size;
          ^
WireGuard/src/crypto/../selftest/poly1305.h:1494:2: note: containing loop
  for (i = 0; i < ARRAY_SIZE(chacha20poly1305_enc_vectors); ++i) {
---
 src/selftest/poly1305.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/selftest/poly1305.h +1 -1
index 2b93d50..9428eba 100644
@@ -1491,7 +1491,7 @@ bool __init poly1305_selftest(void)
 	bool success = true;
 	size_t i;
 
-	for (i = 0; i < ARRAY_SIZE(chacha20poly1305_enc_vectors); ++i) {
+	for (i = 0; i < ARRAY_SIZE(poly1305_testvecs); ++i) {
 		struct poly1305_ctx poly1305;
 		const u8 *in = poly1305_testvecs[i].input.data;
 		size_t inlen = poly1305_testvecs[i].input.size;
Signature · 1 line
2.13.6