Skip to content

Commit

Permalink
cifs: Use kzalloc instead of kmalloc/memset
Browse files Browse the repository at this point in the history
Use kzalloc rather than duplicating its implementation, which
makes code simple and easy to understand.

Signed-off-by: Haowen Bai <[email protected]>
Signed-off-by: Steve French <[email protected]>
  • Loading branch information
Lotte-Bai authored and Steve French committed Apr 18, 2022
1 parent b2d229d commit 9339faa
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions fs/cifs/transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 9339faa

Please sign in to comment.