]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ksmbd: Remove a redundant zeroing of memory
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Mon, 18 Dec 2023 15:32:48 +0000 (00:32 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Dec 2023 09:41:50 +0000 (10:41 +0100)
[ Upstream commit 56b401fb0c506120f25c1b4feeb96d9117efe171 ]

fill_transform_hdr() has only one caller that already clears tr_buf (it is
kzalloc'ed).

So there is no need to clear it another time here.

Remove the superfluous memset() and add a comment to remind that the caller
must clear the buffer.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Hyunchul Lee <hyc.lee@gmail.com>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ksmbd/smb2pdu.c

index cb22e933789b349ea2ec6e63f9e4bde6ed46bf79..6440e78b1be95f95b68c51952eb5ad52d0bc8075 100644 (file)
@@ -8602,7 +8602,7 @@ static void fill_transform_hdr(void *tr_buf, char *old_buf, __le16 cipher_type)
        struct smb2_hdr *hdr = smb2_get_msg(old_buf);
        unsigned int orig_len = get_rfc1002_len(old_buf);
 
-       memset(tr_buf, 0, sizeof(struct smb2_transform_hdr) + 4);
+       /* tr_buf must be cleared by the caller */
        tr_hdr->ProtocolId = SMB2_TRANSFORM_PROTO_NUM;
        tr_hdr->OriginalMessageSize = cpu_to_le32(orig_len);
        tr_hdr->Flags = cpu_to_le16(0x01);