Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 931BEC433E2 for ; Wed, 16 Sep 2020 01:52:26 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0AD542078D; Wed, 16 Sep 2020 01:52:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sourceforge.net header.i=@sourceforge.net header.b="bo6ExFgr"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sf.net header.i=@sf.net header.b="erJNkER4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0AD542078D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-f2fs-devel-bounces@lists.sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1kIMcS-00083e-6v; Wed, 16 Sep 2020 01:52:24 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kIMcQ-000828-Tl for linux-f2fs-devel@lists.sourceforge.net; Wed, 16 Sep 2020 01:52:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:Content-Transfer-Encoding:MIME-Version :Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=XQXinUZo3kkvv+C/kbOf/a+aONN44hp6sBgLjvoojKw=; b=bo6ExFgrSs0P5/xJDO8kPcZ140 XTVTD4HCys73w19k2TSsXO5E67QrMmm/lQwjh99dpurVMYpZQkk0m0dtJjpsafhQw3+Y5DL7BSkKs GVlxAUpPTot4JQgrjpy13S4kCpZ9Og5RgwPIyhTzJ6D4aetaEuVLH0kxNJTB7DGNTBOg=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Type:Content-Transfer-Encoding:MIME-Version:Message-ID:Date: Subject:To:From:Sender:Reply-To:Cc:Content-ID:Content-Description:Resent-Date :Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=XQXinUZo3kkvv+C/kbOf/a+aONN44hp6sBgLjvoojKw=; b=e rJNkER4rLXQajCXXyZHMS86lvJVm5p4PdaRoXjV6TreElkceHfR7klIax0v11m/JFbuZob46ctyAx qI3ygYjnv4XJGStxwW6IIDUidKNh1nUGTtqQjavM2EXWos9vEhenyCVHoiuBhW/MnP0I8PWDFNqoL aAfRlRNBfRwlvDHU=; Received: from szxga05-in.huawei.com ([45.249.212.191] helo=huawei.com) by sfi-mx-3.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1kIMcJ-00AhfT-78 for linux-f2fs-devel@lists.sourceforge.net; Wed, 16 Sep 2020 01:52:22 +0000 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 0DD3D217BA23243E797B; Wed, 16 Sep 2020 09:51:58 +0800 (CST) Received: from huawei.com (10.175.124.27) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.487.0; Wed, 16 Sep 2020 09:51:48 +0800 From: Xiaojun Wang To: , , Date: Wed, 16 Sep 2020 09:54:10 +0800 Message-ID: <20200916015410.4135737-1-wangxiaojun11@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-CFilter-Loop: Reflected X-Headers-End: 1kIMcJ-00AhfT-78 Subject: [f2fs-dev] [PATCH] f2fs: fix wrong total_sections check X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net Meta area is not included in section_count computation. The code in mkfs/f2fs_format.c is: total_zones = get_sb(segment_count) / (c.segs_per_zone) - total_meta_zones; set_sb(section_count, total_zones * c.secs_per_zone); So the minimum total_sections is 1. Signed-off-by: Xiaojun Wang --- fs/f2fs/super.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index dfa072fa8081..a450c8589841 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -2799,8 +2799,7 @@ static int sanity_check_raw_super(struct f2fs_sb_info *sbi, return -EFSCORRUPTED; } - if (total_sections > segment_count || - total_sections < F2FS_MIN_SEGMENTS || + if (total_sections > segment_count || total_sections < 1 || segs_per_sec > segment_count || !segs_per_sec) { f2fs_info(sbi, "Invalid segment/section count (%u, %u x %u)", segment_count, total_sections, segs_per_sec); -- 2.25.1 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel