Cleanup: Use kmem_zalloc() instead of memset() to zero memory
The Linux 5.16.14 kernel's coccicheck caught this. The semantic patch that caught it was: ./scripts/coccinelle/api/alloc/zalloc-simple.cocci Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Closes #14372
This commit is contained in:
parent
7384ec65cd
commit
c9c3ce7976
|
@ -1555,13 +1555,12 @@ zio_crypt_init_uios_normal(boolean_t encrypt, uint8_t *plainbuf,
|
||||||
iovec_t *plain_iovecs = NULL, *cipher_iovecs = NULL;
|
iovec_t *plain_iovecs = NULL, *cipher_iovecs = NULL;
|
||||||
void *src, *dst;
|
void *src, *dst;
|
||||||
|
|
||||||
cipher_iovecs = kmem_alloc(nr_cipher * sizeof (iovec_t),
|
cipher_iovecs = kmem_zalloc(nr_cipher * sizeof (iovec_t),
|
||||||
KM_SLEEP);
|
KM_SLEEP);
|
||||||
if (!cipher_iovecs) {
|
if (!cipher_iovecs) {
|
||||||
ret = SET_ERROR(ENOMEM);
|
ret = SET_ERROR(ENOMEM);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
memset(cipher_iovecs, 0, nr_cipher * sizeof (iovec_t));
|
|
||||||
|
|
||||||
if (encrypt) {
|
if (encrypt) {
|
||||||
src = plainbuf;
|
src = plainbuf;
|
||||||
|
|
Loading…
Reference in New Issue