Skip to contentSkip to conversation

crypto/testmgr: fix uninitialized warning from gcc

PATCH New Mike Frysinger 1 participant 1 message Dec 9, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto/testmgr: fix uninitialized warning from gcc

Since err is not set to a value if tcount is 0, gcc issues a warning:
crypto/testmgr.c: In function ‘test_cprng’:
crypto/testmgr.c:1204: warning: ‘err’ may be used uninitialized in this function

Since this is test code, forcing initialized sanity should be fine.

---
 crypto/testmgr.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
crypto/testmgr.c +1 -0
index 7620bfc..90c4254 100644
@@ -1214,6 +1214,7 @@ static int test_cprng(struct crypto_rng *tfm, struct cprng_testvec *template,
 		return -ENOMEM;
 	}
 
+	err = 0; /* sanity in case tcount is 0 */
 	for (i = 0; i < tcount; i++) {
 		memset(result, 0, 32);
 
Signature · 1 line
1.6.5.5