Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1168104pxp; Sat, 12 Mar 2022 03:40:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJzV6hsGv/MW6Bs5pVBNAoCTyixik9X4L9eqORd2abC3QJDbB2CTMryxTyY5K0TcZqX3HK+g X-Received: by 2002:a05:6402:2706:b0:418:4be3:af50 with SMTP id y6-20020a056402270600b004184be3af50mr5283347edd.93.1647085219476; Sat, 12 Mar 2022 03:40:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1647085219; cv=none; d=google.com; s=arc-20160816; b=AoF5lmd9EPhyQOwhNFWzoSNNopjdB8aMhEDFTMhL3ICNrktMSteHs+ACoHFZGiWiYu LziX/5yeN6l/HF4OQpXhyWXp1Sz8BYsxkCG1FG9PZcYfMy2e+dpm9VQpoqRs6gralhcq J0psJhxwI5A8ybwg97nkMXN6VKdo9vf31Ebr+2gD/RwGNxyYIwTNofw7wxPooCvQQM9Y z7nasa4P417yd99B7KMMTD6NZU9udpDdak61CKKJyUGg4HwBWRgOohR9Wh/GD6N6fUzO ftQjbWgiU0UWL1sHueVTGYVwSUdEqy8+W5Woyh1PMb+NyP/K+T361EMgg3KYKJDpLO7s hi7Q== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Cf3d/zYyP1qElLyGMKalfDePFpmbmiLI2TKBOV9FAj8=; b=BdErdUrCFy4qSSYJBI3sfT9932793WRbiVqy4kBD2slGhA7e34O3zShoM+O1zu3xH2 bcZN8Tp+lMqn66uToH1tJsmnnCgTY2BHKOades6uaG/w+M7CjvanFMB6NHZNPsEO7zhv Pf/TKhOEk+h12vnRnhhgU30sdxYH/BQLIR/N3WEF4MZXIA3Fuyn+Znf8CIn0NAjVg0hN KAH+4JUAkfVhKSv9/ocA5rNf1tJ99f21zO1xLI9o/wO2Va0qaYR/oYJ9HaNhEoiKPmNC FZz8JJBxwJZaK7MgdbOhveKIlgnwx5hXvPDF6QnFzBDIcKVwF70e0lASu7qynR/e+b8w AYJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@inria.fr header.s=dc header.b=r1LvOmlM; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x20-20020a1709060a5400b006d03adbd0b3si6151851ejf.424.2022.03.12.03.39.44; Sat, 12 Mar 2022 03:40:19 -0800 (PST) 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; dkim=pass header.i=@inria.fr header.s=dc header.b=r1LvOmlM; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=inria.fr Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231716AbiCLK2U (ORCPT + 99 others); Sat, 12 Mar 2022 05:28:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229907AbiCLK2T (ORCPT ); Sat, 12 Mar 2022 05:28:19 -0500 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61FE21E6951; Sat, 12 Mar 2022 02:27:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Cf3d/zYyP1qElLyGMKalfDePFpmbmiLI2TKBOV9FAj8=; b=r1LvOmlMPSBgD1ppTQls3Zx1NDsxNu/BY1x1IlAbU4VoDfy0tGxd7p1v 9UDwmqUuvBCgRGtSd5UR4X6K8V1l7ZtjpMe88rbvO2r3tgx9aaHYbrPK9 Ykws3igWEYUgiBIOhLGyjtnrOmUplk3NkoOiT9UGgxTAd3PvoI0hjW5nn w=; Authentication-Results: mail2-relais-roc.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=Julia.Lawall@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="5.90,175,1643670000"; d="scan'208";a="25781347" Received: from i80.paris.inria.fr (HELO i80.paris.inria.fr.) ([128.93.90.48]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Mar 2022 11:27:11 +0100 From: Julia Lawall To: Steve French Cc: kernel-janitors@vger.kernel.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/6] cifs: use kzalloc Date: Sat, 12 Mar 2022 11:27:00 +0100 Message-Id: <20220312102705.71413-2-Julia.Lawall@inria.fr> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220312102705.71413-1-Julia.Lawall@inria.fr> References: <20220312102705.71413-1-Julia.Lawall@inria.fr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, 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 Use kzalloc instead of kmalloc + memset. The semantic patch that makes this change is: (https://coccinelle.gitlabpages.inria.fr/website/) // @@ expression res, size, flag; @@ - res = kmalloc(size, flag); + res = kzalloc(size, flag); ... - memset(res, 0, size); // Signed-off-by: Julia Lawall --- fs/cifs/transport.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index eeb1a699bd6f..4ff8e165a180 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c @@ -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);