linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: Remove unneeded if checks before kfree
@ 2024-03-04 16:55 Thorsten Blum
  2024-03-05 17:16 ` Ritesh Harjani
  0 siblings, 1 reply; 5+ messages in thread
From: Thorsten Blum @ 2024-03-04 16:55 UTC (permalink / raw)
  To: Theodore Ts'o, Andreas Dilger; +Cc: linux-ext4, linux-kernel, Thorsten Blum

kfree already checks if its argument is NULL. This fixes two
Coccinelle/coccicheck warnings reported by ifnullfree.cocci.

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
---
 fs/ext4/super.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 0f931d0c227d..9b7a0b4f2d3d 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2079,8 +2079,7 @@ static int unnote_qf_name(struct fs_context *fc, int qtype)
 {
 	struct ext4_fs_context *ctx = fc->fs_private;
 
-	if (ctx->s_qf_names[qtype])
-		kfree(ctx->s_qf_names[qtype]);
+	kfree(ctx->s_qf_names[qtype]);
 
 	ctx->s_qf_names[qtype] = NULL;
 	ctx->qname_spec |= 1 << qtype;
@@ -2485,8 +2484,7 @@ static int parse_options(struct fs_context *fc, char *options)
 			param.size = v_len;
 
 			ret = ext4_parse_param(fc, &param);
-			if (param.string)
-				kfree(param.string);
+			kfree(param.string);
 			if (ret < 0)
 				return ret;
 		}
-- 
2.44.0


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

* Re: [PATCH] ext4: Remove unneeded if checks before kfree
  2024-03-04 16:55 [PATCH] ext4: Remove unneeded if checks before kfree Thorsten Blum
@ 2024-03-05 17:16 ` Ritesh Harjani
  2024-03-17 15:36   ` [RESEND PATCH] " Thorsten Blum
  0 siblings, 1 reply; 5+ messages in thread
From: Ritesh Harjani @ 2024-03-05 17:16 UTC (permalink / raw)
  To: Thorsten Blum, Theodore Ts'o, Andreas Dilger
  Cc: linux-ext4, linux-kernel, Thorsten Blum

Thorsten Blum <thorsten.blum@toblux.com> writes:

> kfree already checks if its argument is NULL. This fixes two
> Coccinelle/coccicheck warnings reported by ifnullfree.cocci.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
> ---
>  fs/ext4/super.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>

Sure. Thanks for your patch. 
Looks good to me. Feel free to add - 

Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>

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

* [RESEND PATCH] ext4: Remove unneeded if checks before kfree
  2024-03-05 17:16 ` Ritesh Harjani
@ 2024-03-17 15:36   ` Thorsten Blum
  2024-04-12 22:50     ` Thorsten Blum
  0 siblings, 1 reply; 5+ messages in thread
From: Thorsten Blum @ 2024-03-17 15:36 UTC (permalink / raw)
  To: ritesh.list
  Cc: adilger.kernel, linux-ext4, linux-kernel, thorsten.blum, tytso

kfree already checks if its argument is NULL. This fixes two
Coccinelle/coccicheck warnings reported by ifnullfree.cocci.

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
---
 fs/ext4/super.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 0f931d0c227d..9b7a0b4f2d3d 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2079,8 +2079,7 @@ static int unnote_qf_name(struct fs_context *fc, int qtype)
 {
 	struct ext4_fs_context *ctx = fc->fs_private;
 
-	if (ctx->s_qf_names[qtype])
-		kfree(ctx->s_qf_names[qtype]);
+	kfree(ctx->s_qf_names[qtype]);
 
 	ctx->s_qf_names[qtype] = NULL;
 	ctx->qname_spec |= 1 << qtype;
@@ -2485,8 +2484,7 @@ static int parse_options(struct fs_context *fc, char *options)
 			param.size = v_len;
 
 			ret = ext4_parse_param(fc, &param);
-			if (param.string)
-				kfree(param.string);
+			kfree(param.string);
 			if (ret < 0)
 				return ret;
 		}
-- 
2.44.0


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

* [RESEND PATCH] ext4: Remove unneeded if checks before kfree
  2024-03-17 15:36   ` [RESEND PATCH] " Thorsten Blum
@ 2024-04-12 22:50     ` Thorsten Blum
  2024-05-02 20:00       ` Theodore Ts'o
  0 siblings, 1 reply; 5+ messages in thread
From: Thorsten Blum @ 2024-04-12 22:50 UTC (permalink / raw)
  To: thorsten.blum
  Cc: adilger.kernel, linux-ext4, linux-kernel, ritesh.list, tytso

kfree already checks if its argument is NULL. This fixes two
Coccinelle/coccicheck warnings reported by ifnullfree.cocci.

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
---
 fs/ext4/super.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 0f931d0c227d..9b7a0b4f2d3d 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2079,8 +2079,7 @@ static int unnote_qf_name(struct fs_context *fc, int qtype)
 {
 	struct ext4_fs_context *ctx = fc->fs_private;
 
-	if (ctx->s_qf_names[qtype])
-		kfree(ctx->s_qf_names[qtype]);
+	kfree(ctx->s_qf_names[qtype]);
 
 	ctx->s_qf_names[qtype] = NULL;
 	ctx->qname_spec |= 1 << qtype;
@@ -2485,8 +2484,7 @@ static int parse_options(struct fs_context *fc, char *options)
 			param.size = v_len;
 
 			ret = ext4_parse_param(fc, &param);
-			if (param.string)
-				kfree(param.string);
+			kfree(param.string);
 			if (ret < 0)
 				return ret;
 		}
-- 
2.44.0


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

* Re: [RESEND PATCH] ext4: Remove unneeded if checks before kfree
  2024-04-12 22:50     ` Thorsten Blum
@ 2024-05-02 20:00       ` Theodore Ts'o
  0 siblings, 0 replies; 5+ messages in thread
From: Theodore Ts'o @ 2024-05-02 20:00 UTC (permalink / raw)
  To: Thorsten Blum
  Cc: Theodore Ts'o, adilger.kernel, linux-ext4, linux-kernel, ritesh.list


On Sat, 13 Apr 2024 00:50:27 +0200, Thorsten Blum wrote:
> kfree already checks if its argument is NULL. This fixes two
> Coccinelle/coccicheck warnings reported by ifnullfree.cocci.
> 
> 

Applied, thanks!

[1/1] ext4: Remove unneeded if checks before kfree
      commit: ea7d09ad7c280122a322f408672ab8d75c1a0e30

Best regards,
-- 
Theodore Ts'o <tytso@mit.edu>

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

end of thread, other threads:[~2024-05-02 20:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-04 16:55 [PATCH] ext4: Remove unneeded if checks before kfree Thorsten Blum
2024-03-05 17:16 ` Ritesh Harjani
2024-03-17 15:36   ` [RESEND PATCH] " Thorsten Blum
2024-04-12 22:50     ` Thorsten Blum
2024-05-02 20:00       ` Theodore Ts'o

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).