From patchwork Tue Sep 8 13:16:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhaolei X-Patchwork-Id: 7140951 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A320D9F32B for ; Tue, 8 Sep 2015 13:18:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C4B9C2063F for ; Tue, 8 Sep 2015 13:18:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D562E206E3 for ; Tue, 8 Sep 2015 13:18:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754719AbbIHNSd (ORCPT ); Tue, 8 Sep 2015 09:18:33 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:43279 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1754608AbbIHNSc (ORCPT ); Tue, 8 Sep 2015 09:18:32 -0400 X-IronPort-AV: E=Sophos;i="5.15,520,1432569600"; d="scan'208";a="100473618" Received: from bogon (HELO edo.cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 08 Sep 2015 21:21:27 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (localhost.localdomain [127.0.0.1]) by edo.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id t88DIHIr018028 for ; Tue, 8 Sep 2015 21:18:17 +0800 Received: from localhost.localdomain (10.167.226.114) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server id 14.3.181.6; Tue, 8 Sep 2015 21:18:28 +0800 From: Zhao Lei To: CC: Zhao Lei Subject: [PATCH 2/3] btrfs-progs: Avoid uninitialized data in output of btrfs-convert Date: Tue, 8 Sep 2015 21:16:50 +0800 Message-ID: <950a8539e7a587f55d34820049d6ed46aa4acdc8.1441718128.git.zhaolei@cn.fujitsu.com> X-Mailer: git-send-email 1.8.5.1 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP sequence, transid and reserved field of inode was write to disk with uninitizlized value, this patch fixed it. Signed-off-by: Zhao Lei --- btrfs-convert.c | 4 ++++ ctree.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/btrfs-convert.c b/btrfs-convert.c index f4fc650..934f4dc 100644 --- a/btrfs-convert.c +++ b/btrfs-convert.c @@ -1016,6 +1016,8 @@ static int copy_inode_item(struct btrfs_inode_item *dst, struct ext2_inode *src, u32 blocksize) { btrfs_set_stack_inode_generation(dst, 1); + btrfs_set_stack_inode_sequence(dst, 0); + btrfs_set_stack_inode_transid(dst, 1); btrfs_set_stack_inode_size(dst, src->i_size); btrfs_set_stack_inode_nbytes(dst, 0); btrfs_set_stack_inode_block_group(dst, 0); @@ -1052,6 +1054,8 @@ static int copy_inode_item(struct btrfs_inode_item *dst, new_decode_dev(src->i_block[1])); } } + memset(&dst->reserved, 0, sizeof(dst->reserved)); + return 0; } diff --git a/ctree.h b/ctree.h index 2061e1e..c57f9ca 100644 --- a/ctree.h +++ b/ctree.h @@ -1424,6 +1424,8 @@ BTRFS_SETGET_STACK_FUNCS(stack_inode_generation, struct btrfs_inode_item, generation, 64); BTRFS_SETGET_STACK_FUNCS(stack_inode_sequence, struct btrfs_inode_item, sequence, 64); +BTRFS_SETGET_STACK_FUNCS(stack_inode_transid, + struct btrfs_inode_item, transid, 64); BTRFS_SETGET_STACK_FUNCS(stack_inode_size, struct btrfs_inode_item, size, 64); BTRFS_SETGET_STACK_FUNCS(stack_inode_nbytes,