mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ntfs: reparse: remove redundant NULL checks before kvfree()
@ 2026-07-03 17:33 mdshahid03
  2026-07-06  0:31 ` Hyunchul Lee
  2026-07-06 11:32 ` Namjae Jeon
  0 siblings, 2 replies; 3+ messages in thread
From: mdshahid03 @ 2026-07-03 17:33 UTC (permalink / raw)
  To: Namjae Jeon, Hyunchul Lee; +Cc: linux-fsdevel, linux-kernel, Mohammad Shahid

From: Mohammad Shahid <mdshahid03@gmail.com>

kvfree() safely handles NULL pointers, so the explicit NULL checks
before calling kvfree() are unnecessary.

This issue was reported by ifnullfree.cocci.

Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com>
---
 fs/ntfs/reparse.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/ntfs/reparse.c b/fs/ntfs/reparse.c
index fa523dc3691e..ced4c675d91f 100644
--- a/fs/ntfs/reparse.c
+++ b/fs/ntfs/reparse.c
@@ -317,8 +317,7 @@ unsigned int ntfs_make_symlink(struct ntfs_inode *ni)
 	} else
 		ni->flags &= ~FILE_ATTR_REPARSE_POINT;
 
-	if (reparse_attr)
-		kvfree(reparse_attr);
+	kvfree(reparse_attr);
 
 	return mode;
 }
@@ -358,8 +357,7 @@ unsigned int ntfs_reparse_tag_dt_types(struct ntfs_volume *vol, unsigned long mr
 		}
 	}
 
-	if (reparse_attr)
-		kvfree(reparse_attr);
+	kvfree(reparse_attr);
 
 	iput(vi);
 	return dt_type;
-- 
2.43.0


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

* Re: [PATCH] ntfs: reparse: remove redundant NULL checks before kvfree()
  2026-07-03 17:33 [PATCH] ntfs: reparse: remove redundant NULL checks before kvfree() mdshahid03
@ 2026-07-06  0:31 ` Hyunchul Lee
  2026-07-06 11:32 ` Namjae Jeon
  1 sibling, 0 replies; 3+ messages in thread
From: Hyunchul Lee @ 2026-07-06  0:31 UTC (permalink / raw)
  To: mdshahid03; +Cc: Namjae Jeon, linux-fsdevel, linux-kernel

2026년 7월 4일 (토) 오전 2:33, <mdshahid03@gmail.com>님이 작성:
>
> From: Mohammad Shahid <mdshahid03@gmail.com>
>
> kvfree() safely handles NULL pointers, so the explicit NULL checks
> before calling kvfree() are unnecessary.
>
> This issue was reported by ifnullfree.cocci.
>
> Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com>

Looks good to me.

Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com>

> ---
>  fs/ntfs/reparse.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/fs/ntfs/reparse.c b/fs/ntfs/reparse.c
> index fa523dc3691e..ced4c675d91f 100644
> --- a/fs/ntfs/reparse.c
> +++ b/fs/ntfs/reparse.c
> @@ -317,8 +317,7 @@ unsigned int ntfs_make_symlink(struct ntfs_inode *ni)
>         } else
>                 ni->flags &= ~FILE_ATTR_REPARSE_POINT;
>
> -       if (reparse_attr)
> -               kvfree(reparse_attr);
> +       kvfree(reparse_attr);
>
>         return mode;
>  }
> @@ -358,8 +357,7 @@ unsigned int ntfs_reparse_tag_dt_types(struct ntfs_volume *vol, unsigned long mr
>                 }
>         }
>
> -       if (reparse_attr)
> -               kvfree(reparse_attr);
> +       kvfree(reparse_attr);
>
>         iput(vi);
>         return dt_type;
> --
> 2.43.0
>


-- 
Thanks,
Hyunchul

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

* Re: [PATCH] ntfs: reparse: remove redundant NULL checks before kvfree()
  2026-07-03 17:33 [PATCH] ntfs: reparse: remove redundant NULL checks before kvfree() mdshahid03
  2026-07-06  0:31 ` Hyunchul Lee
@ 2026-07-06 11:32 ` Namjae Jeon
  1 sibling, 0 replies; 3+ messages in thread
From: Namjae Jeon @ 2026-07-06 11:32 UTC (permalink / raw)
  To: mdshahid03; +Cc: Hyunchul Lee, linux-fsdevel, linux-kernel

On Sat, Jul 4, 2026 at 2:33 AM <mdshahid03@gmail.com> wrote:
>
> From: Mohammad Shahid <mdshahid03@gmail.com>
>
> kvfree() safely handles NULL pointers, so the explicit NULL checks
> before calling kvfree() are unnecessary.
>
> This issue was reported by ifnullfree.cocci.
>
> Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com>
Applied it to #ntfs-next.
Thanks!

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

end of thread, other threads:[~2026-07-06 11:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-03 17:33 [PATCH] ntfs: reparse: remove redundant NULL checks before kvfree() mdshahid03
2026-07-06  0:31 ` Hyunchul Lee
2026-07-06 11:32 ` Namjae Jeon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®