Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1047076rwr; Thu, 27 Apr 2023 11:31:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ528wJ10k69LdFdhBtSgNmrMlC1nQrWMhoB35qvaisgsft+7Vi+gYU3AtNnlkd2yjdXC2lG X-Received: by 2002:a17:902:7489:b0:1a6:8f8c:fa1a with SMTP id h9-20020a170902748900b001a68f8cfa1amr2672130pll.16.1682620266754; Thu, 27 Apr 2023 11:31:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682620266; cv=none; d=google.com; s=arc-20160816; b=YKxLm85vW4fZXVRCRD1QHS8H8DXjY13wM369b3jFABdUBf62ynW+dnfQNXAg51OX+a BcjCSVIwwpyeB9JIzVYLcO5XgmsOcaL0sRVN3alD2sOurIFW1mNZ2iheRpCZntjtccEC fhjck+AQsJ7dn21tjxDZtqwmHRAi7dEuJjOJniybhMQzelqRerF2J/gwOy6IgIGCvhQL /0BHM99CKcaB5JidDXSAdZ/YW4jP9JLzg2Ra0ACVqhy8C197wUpob6UDeAbzCzRIZzt5 IHDiOVPoQWmdZ/EWwkgzdG4RQXffnUehMu/TkSkDssnlyZ4i6hYSkyld1QR8QVvYYgVA yKlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=VKtzBi/2nY9DzhUMjejrgYCLzsno/DeWpe4ZmOJ/opw=; b=e5iloYaXlX10pEwDQVBvVkOMedCxlpK1GlMydxuDrkgC4ikat/C990gaGvL8jo2P8R 8DSrWOtBx14vLS3/QCxf7fV94hMctr0iSifaJEEwGtixVyM7SVEmmTcLhIP+hF62J0mi X8zp4jBvYlK+jQSEgQUWoRaRtMc5rhU8XFrj/glF+N0EbuL1YjV1fT4Bp2ZKjFa1RqP/ PgQJDl35GgQQJ5pHLrHp43yTYN7Ra70B6W4wsJQgybMTrS72TyvkZiUAqTPuudSw68fL 63VrlSyKcnVvnhLUOvOq8MUszBrfHPNsT54nRLMIAVodjoCVJt2yFOK1dv/M052bRAMj UTbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LY1esqfS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k2-20020a170902d58200b001a69cb5f7besi19080533plh.525.2023.04.27.11.30.52; Thu, 27 Apr 2023 11:31:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LY1esqfS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244540AbjD0SaD (ORCPT + 99 others); Thu, 27 Apr 2023 14:30:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244526AbjD0SaB (ORCPT ); Thu, 27 Apr 2023 14:30:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8E7F4233; Thu, 27 Apr 2023 11:29:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1F76163EDD; Thu, 27 Apr 2023 18:29:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A881C4339B; Thu, 27 Apr 2023 18:29:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1682620198; bh=6raNhLsn3jhA9M0ARzpuznsFRAQ+ToAZBcarkGXjIXs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LY1esqfSsr+T1h4KHxV5BGlbEae9hsQjTFcKCQz7IApBWWc4dLqhwcheEynTyY6/d ntGuE7zatO9/hs8j1IBGxc5aw2uv0DZgpsAa69bDK7+JQBsiB4pUkNETLt6PlcCwQC 6wo7rBBj0J1ZLfuBqUCAFxqIfiwKoWKLl+xfrLoXXAYO0WvQFmWbrdvOFLew4og1EB bOoCfrbEQh0BP9Gxat5DiA/LcMfGCmEd3ziSE2NO9hFfS1rA6i0tv2TVl+CiNC/gLy jeGEvV3nebJlu/dhLwI+tW6VS+Hh8xD9ehJJAVISYIkSAWyHXZdD19raASRI8AHeLw +e8ZhPxyn7Z/g== Date: Thu, 27 Apr 2023 11:29:56 -0700 From: Nathan Chancellor To: Geert Uytterhoeven , tytso@mit.edu Cc: adilger.kernel@dilger.ca, yanaijie@huawei.com, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ext4: Fix unused iterator variable warnings Message-ID: <20230427182956.GA2970@dev-arch.thelio-3990X> References: <20230420-ext4-unused-variables-super-c-v1-1-138b6db6c21c@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Hi Geert, On Thu, Apr 27, 2023 at 02:36:10PM +0200, Geert Uytterhoeven wrote: > On Thu, Apr 20, 2023 at 6:56 PM Nathan Chancellor wrote: > > When CONFIG_QUOTA is disabled, there are warnings around unused iterator > > variables: > > > > fs/ext4/super.c: In function 'ext4_put_super': > > fs/ext4/super.c:1262:13: error: unused variable 'i' [-Werror=unused-variable] > > 1262 | int i, err; > > | ^ > > fs/ext4/super.c: In function '__ext4_fill_super': > > fs/ext4/super.c:5200:22: error: unused variable 'i' [-Werror=unused-variable] > > 5200 | unsigned int i; > > | ^ > > cc1: all warnings being treated as errors > > > > The kernel has updated to gnu11, allowing the variables to be declared > > within the for loop. Do so to clear up the warnings. > > > > Fixes: dcbf87589d90 ("ext4: factor out ext4_flex_groups_free()") > > Signed-off-by: Nathan Chancellor > > Reviewed-by: Geert Uytterhoeven Thank you for the review! > > --- a/fs/ext4/super.c > > +++ b/fs/ext4/super.c > > > @@ -1311,7 +1311,7 @@ static void ext4_put_super(struct super_block *sb) > > ext4_flex_groups_free(sbi); > > ext4_percpu_param_destroy(sbi); > > #ifdef CONFIG_QUOTA > > - for (i = 0; i < EXT4_MAXQUOTAS; i++) > > + for (int i = 0; i < EXT4_MAXQUOTAS; i++) > > int > > > kfree(get_qf_name(sb, sbi, i)); > > #endif > > > > > @@ -5628,7 +5627,7 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb) > > #endif > > > > #ifdef CONFIG_QUOTA > > - for (i = 0; i < EXT4_MAXQUOTAS; i++) > > + for (unsigned int i = 0; i < EXT4_MAXQUOTAS; i++) > > unsigned int > > > kfree(get_qf_name(sb, sbi, i)); > > #endif > > fscrypt_free_dummy_policy(&sbi->s_dummy_enc_policy); > > I do see an opportunity to make this more consistent. > get_qf_name() takes an int for the last parameter, but that should probably > become unsigned int? Yes, or I could have just changed the type of this variable to 'int', as Arnd did in his version; I just chose to keep the existing type so this was basically a "no functional change" patch. https://lore.kernel.org/20230421070815.2260326-1-arnd@kernel.org/ I do not think it fundamentally matters, EXT4_MAXQUOTAS is defined as 3 so I do not think unsigned versus signed semantics matter much here :) I can make that change in a v2 or separate change or we can just take Arnd's patch, but this is now in mainline and there is another patch trying to fix this warning so it would be good to get this dealt with sooner rather than later... https://lore.kernel.org/7ca8f790-c14e-6449-f3b5-4214d3fb1e61@googlemail.com/ Cheers, Nathan