Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2315636rdg; Sun, 15 Oct 2023 23:33:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFkQ37i7i4gVomfvPznCL1YhHKq5ACbC2XZDLQ304OzPvJCYMIeGquCXUUwEHpdHXmTa1+Y X-Received: by 2002:a05:6a00:398d:b0:68a:4103:9938 with SMTP id fi13-20020a056a00398d00b0068a41039938mr31397226pfb.0.1697437998246; Sun, 15 Oct 2023 23:33:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697437998; cv=none; d=google.com; s=arc-20160816; b=moeh/t6f/Wy4/Ne/YAJ4YM5SuJ8gHW7m1ZIi9aCo4BrEQMPhbVjR/Af1kcaLghX+DW NIVDsTlrbFJQYsBT3AiyttJ/D5FN8SjqvOq+VoTNMSsdr50a8l4BqN8YgjklHRMvdlZa iC8IefvBLtLe2e2rCskXTGzceH8rDI8N6us9cSfppWOWN4vdGqnz4kYthg1VGLL8cU5F 4R92L/39ms7M94FXnpdlBUwegb7uBu4hSREd7qUUSRcJMRr6kOFap/adyNXDCW8BSb2I VhY4xwBviSy3+QzpM/9owuiD+JcdXdwZhTr8zHe8qXzsQXaj6NRiGGI8XEF2iSnEh9wQ l2jA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=wRgmhEGdw1Mbrthh+Ogkeu6KnjcN6P8IAw6SOula850=; fh=G4Pxduviz9cgWyQEq1k2zqRNcx1tgxoAEtGH9VlDFJM=; b=xMSirPDcsO/cn32ko4zZuSCcUojFfW05zagRwpWQG/bDjypVikFB+iVWssmYkPQNXl +UghUJiXFA8mPDDXg40ytOknyof/fJZ+0wvOxWMN0Jnrdf5hWeKG5xWbnn3RSiVozjTL gxMdbTs78vGlSZIyhNC1FmqacW3/BcZ/XfWg1Y74/wLJ/xTNNJY79augNyUUKTXFxeS/ Iu+5tM9b9yIuT33z84QUbf+7BI/ND34pQD7z8CeleofOWgPZ+UjW/3BvmVFnXDBA7ThT UxxxX6z5xzkjdvNGUeKvHyB+razA/J9IziZ6RPLOwWS3NSflc69tiN3wmWJBXDNzDLir 36nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=muaGOCdb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id a14-20020aa794ae000000b0069025078128si3959757pfl.240.2023.10.15.23.33.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Oct 2023 23:33:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=muaGOCdb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 4A87B8059E40; Sun, 15 Oct 2023 23:33:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231805AbjJPGdP (ORCPT + 99 others); Mon, 16 Oct 2023 02:33:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231135AbjJPGdO (ORCPT ); Mon, 16 Oct 2023 02:33:14 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1092197 for ; Sun, 15 Oct 2023 23:33:13 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64FD4C433C7; Mon, 16 Oct 2023 06:33:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697437992; bh=+Owi4dHO/M4f1OwrwqDow7OigSWRG5/BMlw4FIabhvQ=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=muaGOCdbAeE393slNe/CMYYTTkBMGihz7xw+znVrPhlxMRVElmU+aXI6BBXN+/MM9 GJ+WAD+ya4zUG7HPfjmwwd1fq/l8Z8KVzOcjuBJVlTRcyoym2qeYm/Q6FmsA3gnfsz lGaVLbUE0+KU+Xt+J9exl16ErejhDqC+3GKgaD9FdWgv/4orpCs84Rx17svhv6efk+ RTSgK1e9GH3zGlL84Llm87A5wstZQymkXmePBd56wa52Q11LRCxIfupmSDJRrZcBCd 8tDDaNzRgvypEO45lJ6e7zNBDTVr1KS8GmUOvubxtqeFIW1qI4tBJ6dkj4dcw9kuEp 0WSQx+TysgD2Q== Message-ID: Date: Mon, 16 Oct 2023 14:33:08 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [f2fs-dev] [PATCH] f2fs-tools: initialize allocated node area Content-Language: en-US To: Daeho Jeong , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com Cc: Daeho Jeong References: <20231013222453.240961-1-daeho43@gmail.com> From: Chao Yu In-Reply-To: <20231013222453.240961-1-daeho43@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sun, 15 Oct 2023 23:33:17 -0700 (PDT) On 2023/10/14 6:24, Daeho Jeong wrote: > From: Daeho Jeong > > Need to initialize allocated node areas after memory allocation. > > Signed-off-by: Daeho Jeong > --- > fsck/node.c | 1 + > include/f2fs_fs.h | 2 ++ > 2 files changed, 3 insertions(+) > > diff --git a/fsck/node.c b/fsck/node.c > index 3761470..6508340 100644 > --- a/fsck/node.c > +++ b/fsck/node.c > @@ -127,6 +127,7 @@ block_t new_node_block(struct f2fs_sb_info *sbi, > > node_blk = calloc(BLOCK_SZ, 1); calloc() has already initialized memory w/ zero, it doesn't need to reinitialize it again? > ASSERT(node_blk); > + memset(node_blk, 0, BLOCK_SZ); > > F2FS_NODE_FOOTER(node_blk)->nid = cpu_to_le32(dn->nid); > F2FS_NODE_FOOTER(node_blk)->ino = F2FS_NODE_FOOTER(f2fs_inode)->ino; > diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h > index 3c7451c..7e22278 100644 > --- a/include/f2fs_fs.h > +++ b/include/f2fs_fs.h > @@ -1826,6 +1826,8 @@ static inline void show_version(const char *prog) > static inline void f2fs_init_inode(struct f2fs_super_block *sb, > struct f2fs_node *raw_node, nid_t ino, time_t mtime, mode_t mode) > { > + memset(raw_node, 0, F2FS_BLKSIZE); Ditto, Thanks, > + > F2FS_NODE_FOOTER(raw_node)->nid = cpu_to_le32(ino); > F2FS_NODE_FOOTER(raw_node)->ino = cpu_to_le32(ino); > F2FS_NODE_FOOTER(raw_node)->cp_ver = cpu_to_le64(1);