cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] [PATCH] gfs2: Remove redundant NULL check before kfree
@ 2022-06-02  7:19 cgel.zte
  2022-06-02  7:57 ` Andreas Gruenbacher
  0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2022-06-02  7:19 UTC (permalink / raw)
  To: cluster-devel.redhat.com

From: Minghao Chi <chi.minghao@zte.com.cn>

kfree on NULL pointer is a no-op.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
---
 fs/gfs2/file.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index 2cceb193dcd8..d8f1239344c1 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -1066,8 +1066,7 @@ static ssize_t gfs2_file_buffered_write(struct kiocb *iocb,
 		gfs2_glock_dq(gh);
 out_uninit:
 	gfs2_holder_uninit(gh);
-	if (statfs_gh)
-		kfree(statfs_gh);
+	kfree(statfs_gh);
 	from->count = orig_count - written;
 	return written ? written : ret;
 }
-- 
2.25.1



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

* [Cluster-devel] [PATCH] gfs2: Remove redundant NULL check before kfree
  2022-06-02  7:19 [Cluster-devel] [PATCH] gfs2: Remove redundant NULL check before kfree cgel.zte
@ 2022-06-02  7:57 ` Andreas Gruenbacher
  0 siblings, 0 replies; 2+ messages in thread
From: Andreas Gruenbacher @ 2022-06-02  7:57 UTC (permalink / raw)
  To: cluster-devel.redhat.com

On Thu, Jun 2, 2022 at 9:19 AM <cgel.zte@gmail.com> wrote:
> From: Minghao Chi <chi.minghao@zte.com.cn>
>
> kfree on NULL pointer is a no-op.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
> ---
>  fs/gfs2/file.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
> index 2cceb193dcd8..d8f1239344c1 100644
> --- a/fs/gfs2/file.c
> +++ b/fs/gfs2/file.c
> @@ -1066,8 +1066,7 @@ static ssize_t gfs2_file_buffered_write(struct kiocb *iocb,
>                 gfs2_glock_dq(gh);
>  out_uninit:
>         gfs2_holder_uninit(gh);
> -       if (statfs_gh)
> -               kfree(statfs_gh);
> +       kfree(statfs_gh);
>         from->count = orig_count - written;
>         return written ? written : ret;
>  }
> --
> 2.25.1
>

Added to for-next, thanks.

Andreas


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

end of thread, other threads:[~2022-06-02  7:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-02  7:19 [Cluster-devel] [PATCH] gfs2: Remove redundant NULL check before kfree cgel.zte
2022-06-02  7:57 ` Andreas Gruenbacher

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