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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68A14C38A2D for ; Mon, 24 Oct 2022 17:26:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231153AbiJXR0d (ORCPT ); Mon, 24 Oct 2022 13:26:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232719AbiJXR0R (ORCPT ); Mon, 24 Oct 2022 13:26:17 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C9401DE3EC for ; Mon, 24 Oct 2022 09:01:18 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 22AC321E82; Mon, 24 Oct 2022 15:29:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1666625387; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=k5tDSQ9reTU5WyF0mG0wYdrynTcc7tc9akL3G/Dfo74=; b=uHPdZvtUNe7Or1F2C/dwTs9kzwatXkjHzDyVkUK/TWpmGJfi2aL/eeMBTe93vmmJXOz6Pz 5l2nYmkIWC8s4TxaoxXyKwflE8TuMmhKoWTjlnsTFpywNGpUcdsRc/OHyWpGvFpwNqa3yO RBLHt9mTyvov8cLDXM5ROVPXPFubUBI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1666625387; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=k5tDSQ9reTU5WyF0mG0wYdrynTcc7tc9akL3G/Dfo74=; b=18njny/mjKJXb8x0AjdQWpacRH+aWP+KGC/IUMtgnfTzcEk8DXPGsIrqSKAb7IozKdMU4K wF1O8iwfILEIOICw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 15B0A13357; Mon, 24 Oct 2022 15:29:47 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id PmlDBWuvVmOURgAAMHmgww (envelope-from ); Mon, 24 Oct 2022 15:29:47 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id 9B670A06F6; Mon, 24 Oct 2022 17:29:46 +0200 (CEST) Date: Mon, 24 Oct 2022 17:29:46 +0200 From: Jan Kara To: Jason Yan Cc: tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz, ritesh.list@gmail.com, lczerner@redhat.com, linux-ext4@vger.kernel.org Subject: Re: [PATCH] ext4: fix wrong return err in ext4_load_and_init_journal() Message-ID: <20221024152946.gafegxwrv5i5djvn@quack3> References: <20221022130739.2515834-1-yanaijie@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221022130739.2515834-1-yanaijie@huawei.com> Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Sat 22-10-22 21:07:39, Jason Yan wrote: > The return value is wrong in ext4_load_and_init_journal(). The local > variable 'err' need to be initialized before goto out. The original code > in __ext4_fill_super() is fine because it has two return values 'ret' > and 'err' and 'ret' is initialized as -EINVAL. After we factor out > ext4_load_and_init_journal(), this code is broken. So fix it by directly > returning -EINVAL in the error handler path. > > Fixes: 9c1dd22d7422 (ext4: factor out ext4_load_and_init_journal()) We format the tag usually as: Fixes: 9c1dd22d7422 ("ext4: factor out ext4_load_and_init_journal()") > Signed-off-by: Jason Yan Otherwise the patch looks good. Feel free to add: Reviewed-by: Jan Kara Honza > --- > fs/ext4/super.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/ext4/super.c b/fs/ext4/super.c > index 989365b878a6..89c6bad28a8a 100644 > --- a/fs/ext4/super.c > +++ b/fs/ext4/super.c > @@ -4885,7 +4885,7 @@ static int ext4_load_and_init_journal(struct super_block *sb, > flush_work(&sbi->s_error_work); > jbd2_journal_destroy(sbi->s_journal); > sbi->s_journal = NULL; > - return err; > + return -EINVAL; > } > > static int ext4_journal_data_mode_check(struct super_block *sb) > -- > 2.31.1 > -- Jan Kara SUSE Labs, CR