From patchwork Thu Jun 7 02:49:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Misono Tomohiro X-Patchwork-Id: 10451039 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6F56A60375 for ; Thu, 7 Jun 2018 02:50:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5EB392949F for ; Thu, 7 Jun 2018 02:50:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 51C8829E52; Thu, 7 Jun 2018 02:50:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3EBE12949F for ; Thu, 7 Jun 2018 02:50:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752954AbeFGCuW (ORCPT ); Wed, 6 Jun 2018 22:50:22 -0400 Received: from mgwym01.jp.fujitsu.com ([211.128.242.40]:36883 "EHLO mgwym01.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752336AbeFGCuV (ORCPT ); Wed, 6 Jun 2018 22:50:21 -0400 Received: from yt-mxoi2.gw.nic.fujitsu.com (unknown [192.168.229.69]) by mgwym01.jp.fujitsu.com with smtp id 54a4_5708_475505f7_9a04_4b74_ba4e_56238965afc0; Thu, 07 Jun 2018 11:50:14 +0900 Received: from g01jpfmpwyt02.exch.g01.fujitsu.local (g01jpfmpwyt02.exch.g01.fujitsu.local [10.128.193.56]) by yt-mxoi2.gw.nic.fujitsu.com (Postfix) with ESMTP id 36620AC00D5 for ; Thu, 7 Jun 2018 11:50:14 +0900 (JST) Received: from G01JPEXCHYT14.g01.fujitsu.local (G01JPEXCHYT14.g01.fujitsu.local [10.128.194.53]) by g01jpfmpwyt02.exch.g01.fujitsu.local (Postfix) with ESMTP id 5DD5658425C for ; Thu, 7 Jun 2018 11:50:13 +0900 (JST) X-SecurityPolicyCheck: OK by SHieldMailChecker v2.5.2 X-SHieldMailCheckerPolicyVersion: FJ-ISEC-20170217-enc X-SHieldMailCheckerMailID: 1c656af9d92a456b88a7851b77bba8db From: Misono Tomohiro Subject: [PATCH] btrfs-progs: check: Initialize all filed of btrfs_inode_item in insert_inode_item() References: To: linux-btrfs Message-ID: Date: Thu, 7 Jun 2018 11:49:58 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-SecurityPolicyCheck-GC: OK by FENCE-Mail X-TM-AS-MML: disable Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Initialize all filed of btrfs_inode_item to zero in order to prevent having some garbage, especially for flags field. Signed-off-by: Misono Tomohiro --- check/mode-common.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/check/mode-common.c b/check/mode-common.c index db9e4299..15e2bbd1 100644 --- a/check/mode-common.c +++ b/check/mode-common.c @@ -379,18 +379,14 @@ int insert_inode_item(struct btrfs_trans_handle *trans, time_t now = time(NULL); int ret; + memset(&ii, 0, sizeof(ii)); btrfs_set_stack_inode_size(&ii, size); btrfs_set_stack_inode_nbytes(&ii, nbytes); btrfs_set_stack_inode_nlink(&ii, nlink); btrfs_set_stack_inode_mode(&ii, mode); btrfs_set_stack_inode_generation(&ii, trans->transid); - btrfs_set_stack_timespec_nsec(&ii.atime, 0); btrfs_set_stack_timespec_sec(&ii.ctime, now); - btrfs_set_stack_timespec_nsec(&ii.ctime, 0); btrfs_set_stack_timespec_sec(&ii.mtime, now); - btrfs_set_stack_timespec_nsec(&ii.mtime, 0); - btrfs_set_stack_timespec_sec(&ii.otime, 0); - btrfs_set_stack_timespec_nsec(&ii.otime, 0); ret = btrfs_insert_inode(trans, root, ino, &ii); ASSERT(!ret);