Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2294723pxm; Sun, 27 Feb 2022 17:22:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJw+lgnwGhx2AIF6QDALmqtMMeKdPRR5Kk/smgZVgB3vkffrAn/MVCCSJIDgrRm/8opM+3Zk X-Received: by 2002:a17:902:e74a:b0:150:25f4:f433 with SMTP id p10-20020a170902e74a00b0015025f4f433mr14566478plf.21.1646011371172; Sun, 27 Feb 2022 17:22:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646011371; cv=none; d=google.com; s=arc-20160816; b=XCe0GzFya5tIxnHRlyCcq+DfCQsuhxG7hr5U6ViRjqv8joiRzzPKMP9f5Hqk1HrQzK 3CcLcFD9fJPpiNncR/HzRPSD8GL1ED3VUbP6Xk3ITZfGMkJEa6LafdrO9caaR5ArICZh XD1bZ3Z5PH+c8kV65J08HDf449xf+73vHqoU7Dt3Yc3g8CXQBNto4/U/mgAMji+erPZq 4zM9mZvlaXAEWKz677qr1HjPt4gjQC4yGtOf218if4Ht9NkydFEkXYSE/CiS9Hr7RouH tRoVoy6uXxK3oQkey/TFurS0vqBOHDwzmImX2A9mimeJYZFq7SPazzmtUcRy/q0h0255 LmWA== 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:to:from :dkim-signature; bh=A3F0fX9JrAlsUugif9Q+TNxEblj89fNI5T4G5cqu5VI=; b=JDbkMSd8V+e2ZBYhNO3hxCscdm1THPgHETpI0f/2IPyjEioP17u6jdN3E/ytoL7Lpf hIoVWXDYiNegVcipGB4Rp7VrcC16dvIf01xJ34pruh/5eWjjqOxmTSYe7bnD492hXfC7 NoC654AbEpIhcXr3XozkPQLsFENsCqhc4Z4yaIZEvFz/S/A0NIaP3IpqQ/DLSJU+EgMy oVmUHIFU9P0qTHVYB5DxRh6Gr0lPZZB0nkCp2Dqx91Ct9D1kZGYRZkV2+xtQgbC9oUA/ 6lQfaRyNOAnIhN8WhWF1+3zaesYghRvxxarAds36+vOimL9OyrNXtsEDXTjzp14h1TPs phJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JPitooxv; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 35-20020a17090a09a600b001bcba20f850si8197693pjo.180.2022.02.27.17.22.36; Sun, 27 Feb 2022 17:22:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-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=@kernel.org header.s=k20201202 header.b=JPitooxv; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232197AbiB0XTR (ORCPT + 99 others); Sun, 27 Feb 2022 18:19:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232192AbiB0XTQ (ORCPT ); Sun, 27 Feb 2022 18:19:16 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 662B022504 for ; Sun, 27 Feb 2022 15:18:38 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2647BB80CDE for ; Sun, 27 Feb 2022 23:18:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 943ECC340F4 for ; Sun, 27 Feb 2022 23:18:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646003915; bh=MmRjb0IrsOuCdjpF4K+k4IyOZ+lwxr6BM19ISvFn1VY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=JPitooxviwwun316bz6sUDk2Bx9nXfO6LHgFKQDsjzSOpcmcN73cFnNGNO2jI3cAD 6uK1G+gSrYBS+kjt6w7P2biroTlHzUWImG0k0YEsjZ0T4k/oPfOuagSAsl2hi49/kX 2Wbkaf12dtaBaygiwOA61Isnf/EEw1O2Oxgjd8mJBECJzZkROnYkLY+0LU4kEJHuP1 vd+wEE4FFKmwAzfwQn9beML/t8ndzD0Ru7GZOctSl/FMAsFMfdVsbO2lPq7psodlvf JZ96HUhlpKjOGhlQvCZPQM8buZ2Zw4hlEwXXfadYsq/ZKpa4doySHHtvy6BZerBfbE 2MVOFTnd3pzsw== From: trondmy@kernel.org To: linux-nfs@vger.kernel.org Subject: [PATCH v9 05/27] NFS: Use kzalloc() to avoid initialising the nfs_open_dir_context Date: Sun, 27 Feb 2022 18:12:05 -0500 Message-Id: <20220227231227.9038-6-trondmy@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220227231227.9038-5-trondmy@kernel.org> References: <20220227231227.9038-1-trondmy@kernel.org> <20220227231227.9038-2-trondmy@kernel.org> <20220227231227.9038-3-trondmy@kernel.org> <20220227231227.9038-4-trondmy@kernel.org> <20220227231227.9038-5-trondmy@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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-nfs@vger.kernel.org From: Trond Myklebust Signed-off-by: Trond Myklebust --- fs/nfs/dir.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 1dfbd05081ad..379f88b158fb 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -69,18 +69,15 @@ const struct address_space_operations nfs_dir_aops = { .freepage = nfs_readdir_clear_array, }; -static struct nfs_open_dir_context *alloc_nfs_open_dir_context(struct inode *dir) +static struct nfs_open_dir_context * +alloc_nfs_open_dir_context(struct inode *dir) { struct nfs_inode *nfsi = NFS_I(dir); struct nfs_open_dir_context *ctx; - ctx = kmalloc(sizeof(*ctx), GFP_KERNEL_ACCOUNT); + + ctx = kzalloc(sizeof(*ctx), GFP_KERNEL_ACCOUNT); if (ctx != NULL) { - ctx->duped = 0; ctx->attr_gencount = nfsi->attr_gencount; - ctx->dir_cookie = 0; - ctx->dup_cookie = 0; - ctx->page_index = 0; - ctx->eof = false; spin_lock(&dir->i_lock); if (list_empty(&nfsi->open_files) && (nfsi->cache_validity & NFS_INO_DATA_INVAL_DEFER)) -- 2.35.1