cifs: Use kzalloc instead of kmalloc/memset

Use kzalloc rather than duplicating its implementation, which
makes code simple and easy to understand.

Signed-off-by: Haowen Bai <baihaowen@meizu.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
Haowen Bai 2022-04-18 18:26:26 +08:00 committed by Steve French
parent b2d229d4dd
commit 9339faac6d

View File

@ -464,13 +464,12 @@ smb_send_rqst(struct TCP_Server_Info *server, int num_rqst,
return -EIO; return -EIO;
} }
tr_hdr = kmalloc(sizeof(*tr_hdr), GFP_NOFS); tr_hdr = kzalloc(sizeof(*tr_hdr), GFP_NOFS);
if (!tr_hdr) if (!tr_hdr)
return -ENOMEM; return -ENOMEM;
memset(&cur_rqst[0], 0, sizeof(cur_rqst)); memset(&cur_rqst[0], 0, sizeof(cur_rqst));
memset(&iov, 0, sizeof(iov)); memset(&iov, 0, sizeof(iov));
memset(tr_hdr, 0, sizeof(*tr_hdr));
iov.iov_base = tr_hdr; iov.iov_base = tr_hdr;
iov.iov_len = sizeof(*tr_hdr); iov.iov_len = sizeof(*tr_hdr);