summaryrefslogtreecommitdiffstats
path: root/crypto/testmgr.c
diff options
context:
space:
mode:
authorMichael Schupikov <michael@schupikov.de>2018-10-07 07:58:10 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2018-10-12 02:20:45 -0400
commit22a8118d329334833cd30f2ceb36d28e8cae8a4f (patch)
treeef51d04023cc6f3ad80d18719a93a4bcde8fc68b /crypto/testmgr.c
parentcb1af1f5991648e33dfae1f0194accc42b6fbf73 (diff)
crypto: testmgr - fix sizeof() on COMP_BUF_SIZE
After allocation, output and decomp_output both point to memory chunks of size COMP_BUF_SIZE. Then, only the first bytes are zeroed out using sizeof(COMP_BUF_SIZE) as parameter to memset(), because sizeof(COMP_BUF_SIZE) provides the size of the constant and not the size of allocated memory. Instead, the whole allocated memory is meant to be zeroed out. Use COMP_BUF_SIZE as parameter to memset() directly in order to accomplish this. Fixes: 336073840a872 ("crypto: testmgr - Allow different compression results") Signed-off-by: Michael Schupikov <michael@schupikov.de> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/testmgr.c')
-rw-r--r--crypto/testmgr.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index bd13bc971e2b..b1f79c6bf409 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -1400,8 +1400,8 @@ static int test_comp(struct crypto_comp *tfm,
1400 int ilen; 1400 int ilen;
1401 unsigned int dlen = COMP_BUF_SIZE; 1401 unsigned int dlen = COMP_BUF_SIZE;
1402 1402
1403 memset(output, 0, sizeof(COMP_BUF_SIZE)); 1403 memset(output, 0, COMP_BUF_SIZE);
1404 memset(decomp_output, 0, sizeof(COMP_BUF_SIZE)); 1404 memset(decomp_output, 0, COMP_BUF_SIZE);
1405 1405
1406 ilen = ctemplate[i].inlen; 1406 ilen = ctemplate[i].inlen;
1407 ret = crypto_comp_compress(tfm, ctemplate[i].input, 1407 ret = crypto_comp_compress(tfm, ctemplate[i].input,
@@ -1445,7 +1445,7 @@ static int test_comp(struct crypto_comp *tfm,
1445 int ilen; 1445 int ilen;
1446 unsigned int dlen = COMP_BUF_SIZE; 1446 unsigned int dlen = COMP_BUF_SIZE;
1447 1447
1448 memset(decomp_output, 0, sizeof(COMP_BUF_SIZE)); 1448 memset(decomp_output, 0, COMP_BUF_SIZE);
1449 1449
1450 ilen = dtemplate[i].inlen; 1450 ilen = dtemplate[i].inlen;
1451 ret = crypto_comp_decompress(tfm, dtemplate[i].input, 1451 ret = crypto_comp_decompress(tfm, dtemplate[i].input,