From mboxrd@z Thu Jan 1 00:00:00 1970 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=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 66E5FC2BA19 for ; Wed, 15 Apr 2020 12:44:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3B661206A2 for ; Wed, 15 Apr 2020 12:44:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586954658; bh=ZGYe20mJoQzycxAYk9OTE2qqIIK1qWUHJXIKff/rfkY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=PhIisn3TqhZrGfPSjn4umxKSG3kxFeit1ia8njaq6F90wZH5RrtdD1hFnaVTigVSy oGfGHLlzHFokbdaIDRZILP9dLdKQxhX/n653xzRzfuP4kgPZ46swFN1KOAjH949ieR DhsE/40GeS4WX3Jcsroi5SY+YI7PUxKHXpCm5FSo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S370150AbgDOMoP (ORCPT ); Wed, 15 Apr 2020 08:44:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:35346 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2897511AbgDOLnY (ORCPT ); Wed, 15 Apr 2020 07:43:24 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BB33E20936; Wed, 15 Apr 2020 11:43:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1586951004; bh=ZGYe20mJoQzycxAYk9OTE2qqIIK1qWUHJXIKff/rfkY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lTH1yyDXbOLMlhW4CPIjezGLoDsUpCBn1NeQhh3lC0PkahN9quQkWOWDlVFMYx1Bm Gy6y6+huA5hNlXbrCQVjFXe1YUgAQ9TAnSTWfWxGd3Brb5Du8C43Ah4UALV9gMAUXl W4Yaj6uUGiE+AKSiWuewtyhAWqeCs8cfTUcth1ZQ= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Josh Triplett , Theodore Ts'o , Sasha Levin , linux-ext4@vger.kernel.org Subject: [PATCH AUTOSEL 5.5 049/106] ext4: fix incorrect group count in ext4_fill_super error message Date: Wed, 15 Apr 2020 07:41:29 -0400 Message-Id: <20200415114226.13103-49-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200415114226.13103-1-sashal@kernel.org> References: <20200415114226.13103-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Josh Triplett [ Upstream commit df41460a21b06a76437af040d90ccee03888e8e5 ] ext4_fill_super doublechecks the number of groups before mounting; if that check fails, the resulting error message prints the group count from the ext4_sb_info sbi, which hasn't been set yet. Print the freshly computed group count instead (which at that point has just been computed in "blocks_count"). Signed-off-by: Josh Triplett Fixes: 4ec1102813798 ("ext4: Add sanity checks for the superblock before mounting the filesystem") Link: https://lore.kernel.org/r/8b957cd1513fcc4550fe675c10bcce2175c33a49.1585431964.git.josh@joshtriplett.org Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin --- fs/ext4/super.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index f59c587faccb5..3b4fc5036d91b 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -4242,9 +4242,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) EXT4_BLOCKS_PER_GROUP(sb) - 1); do_div(blocks_count, EXT4_BLOCKS_PER_GROUP(sb)); if (blocks_count > ((uint64_t)1<<32) - EXT4_DESC_PER_BLOCK(sb)) { - ext4_msg(sb, KERN_WARNING, "groups count too large: %u " + ext4_msg(sb, KERN_WARNING, "groups count too large: %llu " "(block count %llu, first data block %u, " - "blocks per group %lu)", sbi->s_groups_count, + "blocks per group %lu)", blocks_count, ext4_blocks_count(es), le32_to_cpu(es->s_first_data_block), EXT4_BLOCKS_PER_GROUP(sb)); -- 2.20.1