1
0
Fork 0

dm integrity: use kzalloc() instead of kmalloc() + memset()

Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
alistair/sunxi64-5.4-dsi
Fuqian Huang 2019-06-28 10:47:34 +08:00 committed by Mike Snitzer
parent d370ad23a5
commit 131670c262
1 changed files with 1 additions and 2 deletions

View File

@ -3360,7 +3360,7 @@ static int create_journal(struct dm_integrity_c *ic, char **error)
goto bad;
}
crypt_iv = kmalloc(ivsize, GFP_KERNEL);
crypt_iv = kzalloc(ivsize, GFP_KERNEL);
if (!crypt_iv) {
*error = "Could not allocate iv";
r = -ENOMEM;
@ -3389,7 +3389,6 @@ static int create_journal(struct dm_integrity_c *ic, char **error)
sg_set_buf(&sg[i], va, PAGE_SIZE);
}
sg_set_buf(&sg[i], &ic->commit_ids, sizeof ic->commit_ids);
memset(crypt_iv, 0x00, ivsize);
skcipher_request_set_crypt(req, sg, sg,
PAGE_SIZE * ic->journal_pages + sizeof ic->commit_ids, crypt_iv);