]> git.baikalelectronics.ru Git - kernel.git/commitdiff
cifs: Use kzalloc instead of kmalloc/memset
authorHaowen Bai <baihaowen@meizu.com>
Mon, 18 Apr 2022 10:26:26 +0000 (18:26 +0800)
committerSteve French <stfrench@microsoft.com>
Mon, 18 Apr 2022 15:22:57 +0000 (10:22 -0500)
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>
fs/cifs/transport.c

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