Commit 25f5d74c authored by Andrew Morton's avatar Andrew Morton Committed by David S. Miller

[CRYPTO]: Fix memcpy/memset args.

parent 4e4d6a6f
......@@ -81,7 +81,7 @@ static int deflate_comp_init(struct deflate_ctx *ctx)
ret = -ENOMEM;
goto out;
}
memset(stream->workspace, 0, sizeof(stream->workspace));
memset(stream->workspace, 0, zlib_deflate_workspacesize());
ret = zlib_deflateInit2(stream, DEFLATE_DEF_LEVEL, Z_DEFLATED,
-DEFLATE_DEF_WINBITS, DEFLATE_DEF_MEMLEVEL,
Z_DEFAULT_STRATEGY);
......@@ -108,7 +108,7 @@ static int deflate_decomp_init(struct deflate_ctx *ctx)
ret = -ENOMEM;
goto out;
}
memset(stream->workspace, 0, sizeof(stream->workspace));
memset(stream->workspace, 0, zlib_inflate_workspacesize());
ret = zlib_inflateInit2(stream, -DEFLATE_DEF_WINBITS);
if (ret != Z_OK) {
ret = -EINVAL;
......
......@@ -215,7 +215,7 @@ static void md4_final(void *ctx, u8 *out)
md4_transform(mctx->hash, mctx->block);
cpu_to_le32_array(mctx->hash, sizeof(mctx->hash) / sizeof(u32));
memcpy(out, mctx->hash, sizeof(mctx->hash));
memset(mctx, 0, sizeof(mctx));
memset(mctx, 0, sizeof(*mctx));
}
static struct crypto_alg alg = {
......
......@@ -210,7 +210,7 @@ static void md5_final(void *ctx, u8 *out)
md5_transform(mctx->hash, mctx->block);
cpu_to_le32_array(mctx->hash, sizeof(mctx->hash) / sizeof(u32));
memcpy(out, mctx->hash, sizeof(mctx->hash));
memset(mctx, 0, sizeof(mctx));
memset(mctx, 0, sizeof(*mctx));
}
static struct crypto_alg alg = {
......
......@@ -113,7 +113,7 @@ test_md5(void)
printk("\ntesting md5 across pages\n");
/* setup the dummy buffer first */
memset(xbuf, 0, sizeof (xbuf));
memset(xbuf, 0, XBUFSIZE);
memcpy(&xbuf[IDX1], "abcdefghijklm", 13);
memcpy(&xbuf[IDX2], "nopqrstuvwxyz", 13);
......@@ -188,7 +188,7 @@ test_hmac_md5(void)
printk("\ntesting hmac_md5 across pages\n");
memset(xbuf, 0, sizeof (xbuf));
memset(xbuf, 0, XBUFSIZE);
memcpy(&xbuf[IDX1], "what do ya want ", 16);
memcpy(&xbuf[IDX2], "for nothing?", 12);
......@@ -267,7 +267,7 @@ test_hmac_sha1(void)
printk("\ntesting hmac_sha1 across pages\n");
/* setup the dummy buffer first */
memset(xbuf, 0, sizeof (xbuf));
memset(xbuf, 0, XBUFSIZE);
memcpy(&xbuf[IDX1], "what do ya want ", 16);
memcpy(&xbuf[IDX2], "for nothing?", 12);
......@@ -450,7 +450,7 @@ test_sha1(void)
printk("\ntesting sha1 across pages\n");
/* setup the dummy buffer first */
memset(xbuf, 0, sizeof (xbuf));
memset(xbuf, 0, XBUFSIZE);
memcpy(&xbuf[IDX1], "abcdbcdecdefdefgefghfghighij", 28);
memcpy(&xbuf[IDX2], "hijkijkljklmklmnlmnomnopnopq", 28);
......@@ -525,7 +525,7 @@ test_sha256(void)
printk("\ntesting sha256 across pages\n");
/* setup the dummy buffer first */
memset(xbuf, 0, sizeof (xbuf));
memset(xbuf, 0, XBUFSIZE);
memcpy(&xbuf[IDX1], "abcdbcdecdefdefgefghfghighij", 28);
memcpy(&xbuf[IDX2], "hijkijkljklmklmnlmnomnopnopq", 28);
......@@ -1027,7 +1027,7 @@ test_des(void)
}
/* setup the dummy buffer first */
memset(xbuf, 0, sizeof (xbuf));
memset(xbuf, 0, XBUFSIZE);
xbuf[IDX1] = des_tv[i].plaintext[0];
xbuf[IDX2] = des_tv[i].plaintext[1];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment