linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: handle unsuccessful sbi allocation
@ 2022-01-25 13:06 Ameer Hamza
  2022-01-25 13:36 ` Lukas Czerner
  0 siblings, 1 reply; 2+ messages in thread
From: Ameer Hamza @ 2022-01-25 13:06 UTC (permalink / raw)
  To: tytso, adilger.kernel; +Cc: linux-ext4, linux-kernel, amhamza.mgc

Move to common fail path in case of unsuccessful sbi allocation

Addresses-Coverity: 1497833 ("Unused value")

Signed-off-by: Ameer Hamza <amhamza.mgc@gmail.com>
---
 fs/ext4/super.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 57914acc5402..0dccf1ed931b 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -5540,8 +5540,10 @@ static int ext4_fill_super(struct super_block *sb, struct fs_context *fc)
 	int ret;
 
 	sbi = ext4_alloc_sbi(sb);
-	if (!sbi)
+	if (!sbi) {
 		ret = -ENOMEM;
+		goto free_sbi;
+	}
 
 	fc->s_fs_info = sbi;
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ext4: handle unsuccessful sbi allocation
  2022-01-25 13:06 [PATCH] ext4: handle unsuccessful sbi allocation Ameer Hamza
@ 2022-01-25 13:36 ` Lukas Czerner
  0 siblings, 0 replies; 2+ messages in thread
From: Lukas Czerner @ 2022-01-25 13:36 UTC (permalink / raw)
  To: Ameer Hamza; +Cc: tytso, adilger.kernel, linux-ext4, linux-kernel

We already have a patch to fix the problem on this list

https://lore.kernel.org/linux-ext4/20220119130209.40112-1-lczerner@redhat.com/T/#u

-Lukas

On Tue, Jan 25, 2022 at 06:06:04PM +0500, Ameer Hamza wrote:
> Move to common fail path in case of unsuccessful sbi allocation
> 
> Addresses-Coverity: 1497833 ("Unused value")
> 
> Signed-off-by: Ameer Hamza <amhamza.mgc@gmail.com>
> ---
>  fs/ext4/super.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 57914acc5402..0dccf1ed931b 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -5540,8 +5540,10 @@ static int ext4_fill_super(struct super_block *sb, struct fs_context *fc)
>  	int ret;
>  
>  	sbi = ext4_alloc_sbi(sb);
> -	if (!sbi)
> +	if (!sbi) {
>  		ret = -ENOMEM;
> +		goto free_sbi;
> +	}
>  
>  	fc->s_fs_info = sbi;
>  
> -- 
> 2.25.1
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-25 13:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-25 13:06 [PATCH] ext4: handle unsuccessful sbi allocation Ameer Hamza
2022-01-25 13:36 ` Lukas Czerner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).