Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3945000pxp; Wed, 23 Mar 2022 08:33:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZ02JJhtrL6EyFtxhjxBeXLJD6ERKq3wwpLW63F40Fvr1kL5mVz2PtUHhBUe3TNoZa911a X-Received: by 2002:a4a:98b0:0:b0:320:5a26:c989 with SMTP id a45-20020a4a98b0000000b003205a26c989mr260983ooj.62.1648049627097; Wed, 23 Mar 2022 08:33:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648049627; cv=none; d=google.com; s=arc-20160816; b=P8smWQDPnKQ8CDxpeXs5f1zxK8Uq6cX3XPT7CR5vSXKwtuQjzcHwhRdpbuMF5Mx0go QPk6U5HV9Kp8Eq0NLAIuIkL1zJSuy3lQ+5/q1i3FmT1xmXgXjUu7Ne9Oytcdi8gmjSmw 6XC7TRNoVj3HVxJ7SggmpO5xOoED3JMSdAVizZ68yANbrX+pRcjl649tARcr+RHxO+Ug MfV8RO6FcmYgAZ6L3BXKMlvEO5pwRf+6c/D8rsqElRFZ2OtHU4iR9GrSM5bynUN3P8xN wvClvLtyQ4fZD28D5pQHzovZbpyNdhIp5/KwowWC7R/I8dGn0Zfe4CE5i/omKHYZdU3L h13A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=DZFkj2RxIYnxe1cbkhiAREx+r4AGyOVRszxDO9sU+00=; b=ReA43r3QmU4h3Z2csCeHSie/JEgDnDie6aIs4Kn8VnBC4MQsLXQ+KeiCnLppHXqJOF nI7Mp5bHsVupMl2fDKSY/apx0lq93RluiSBgwfM3nmXiLBLvQ0eCSWGePBtMPFqUWtks 3iq8WOhUX0B8WCpQhFczwRUimNg6VkQsChmE9Jc5Slm3qAeGHrYEsjusBJyo5iUBPH2u QAYmvdtGvgTKZ7GoJxgvmcsP+G8kOqrLpqYQba83bWG9DChSG6jb4CDc8w4i7FkXmruc 2FfcTSqcBCAtvqp4Po+hu5/b8jdTz/34mzgxDfMrdbuhyHj1JW8X4ORVavi6SRy9K2il fsCQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r70-20020acaa849000000b002ef0c3476a9si7307205oie.297.2022.03.23.08.33.32; Wed, 23 Mar 2022 08:33:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241969AbiCWGdl (ORCPT + 99 others); Wed, 23 Mar 2022 02:33:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241970AbiCWGdk (ORCPT ); Wed, 23 Mar 2022 02:33:40 -0400 Received: from smtp.smtpout.orange.fr (smtp04.smtpout.orange.fr [80.12.242.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87C9F716ED for ; Tue, 22 Mar 2022 23:32:10 -0700 (PDT) Received: from pop-os.home ([90.126.236.122]) by smtp.orange.fr with ESMTPA id WuXPnSkMs9VRxWuXPnBGAk; Wed, 23 Mar 2022 07:32:08 +0100 X-ME-Helo: pop-os.home X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Wed, 23 Mar 2022 07:32:08 +0100 X-ME-IP: 90.126.236.122 From: Christophe JAILLET To: Namjae Jeon , Sergey Senozhatsky , Steve French , Hyunchul Lee Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-cifs@vger.kernel.org Subject: [PATCH v2] ksmbd: Remove a redundant zeroing of memory Date: Wed, 23 Mar 2022 07:32:05 +0100 Message-Id: <577b4601aa5d62d222fa9387c5036f2504f40318.1648017112.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- v2: keep kzalloc in the caller and remove the memset here --- fs/ksmbd/smb2pdu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c index bcb98109bac9..bcd1bb7e2856 100644 --- a/fs/ksmbd/smb2pdu.c +++ b/fs/ksmbd/smb2pdu.c @@ -8410,7 +8410,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(TRANSFORM_FLAG_ENCRYPTED); -- 2.32.0