crypto: mediatek - don't return garbage err on successful return
authorColin Ian King <colin.king@canonical.com>
Tue, 3 Jan 2017 13:21:22 +0000 (13:21 +0000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 12 Jan 2017 16:24:42 +0000 (00:24 +0800)
In the case where keylen <= bs mtk_sha_setkey returns an uninitialized
return value in err.  Fix this by returning 0 instead of err.

Issue detected by static analysis with cppcheck.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/mediatek/mtk-sha.c

index 89513632c8ed59d01a3ba52f7613c453e353f3e9..8e1b440fedf06e4757c023bbc39cf9ee8dcb51fa 100644 (file)
@@ -878,7 +878,7 @@ static int mtk_sha_setkey(struct crypto_ahash *tfm,
                bctx->opad[i] ^= 0x5c;
        }
 
-       return err;
+       return 0;
 }
 
 static int mtk_sha_export(struct ahash_request *req, void *out)