Linux CIFS filesystem development
 help / color / mirror / Atom feed
* [PATCH] smb: client: remove redundant NULL check before kfree()
@ 2026-07-03 12:21 mdshahid03
  2026-07-24 12:31 ` mdshahid03
  2026-08-21 16:40 ` Paulo Alcantara
  0 siblings, 2 replies; 4+ messages in thread
From: mdshahid03 @ 2026-07-03 12:21 UTC (permalink / raw)
  To: Steve French, Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N,
	Tom Talpey, Bharath SM
  Cc: linux-cifs, samba-technical, linux-kernel, Mohammad Shahid

From: Mohammad Shahid <mdshahid03@gmail.com>

kfree() safely handles NULL pointers, so the explicit NULL check
before calling kfree() is unnecessary.

This issue was reported by ifnullfree.cocci.

Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com>
---
 fs/smb/client/ioctl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/smb/client/ioctl.c b/fs/smb/client/ioctl.c
index 9fa743be3652..2f152d76be7d 100644
--- a/fs/smb/client/ioctl.c
+++ b/fs/smb/client/ioctl.c
@@ -133,8 +133,7 @@ static int cifs_set_compression_by_path(unsigned int xid, struct file *filep,
 
 close:
 	server->ops->close(xid, tcon, &fid);
-	if (tmp_cfile)
-		kfree(tmp_cfile);
+	kfree(tmp_cfile);
 	cifs_free_open_info(&data);
 out:
 	free_dentry_path(page);
-- 
2.43.0


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

* Re: [PATCH] smb: client: remove redundant NULL check before kfree()
  2026-07-03 12:21 [PATCH] smb: client: remove redundant NULL check before kfree() mdshahid03
@ 2026-07-24 12:31 ` mdshahid03
  2026-07-25 16:41   ` Steve French
  2026-08-21 16:40 ` Paulo Alcantara
  1 sibling, 1 reply; 4+ messages in thread
From: mdshahid03 @ 2026-07-24 12:31 UTC (permalink / raw)
  To: Steve French, Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N,
	Tom Talpey, Bharath SM
  Cc: linux-cifs, samba-technical, linux-kernel

Hi,

Gentle ping on this patch.

Could you please take a look when time permits?

Thanks!

Mohammad Shahid


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

* Re: [PATCH] smb: client: remove redundant NULL check before kfree()
  2026-07-24 12:31 ` mdshahid03
@ 2026-07-25 16:41   ` Steve French
  0 siblings, 0 replies; 4+ messages in thread
From: Steve French @ 2026-07-25 16:41 UTC (permalink / raw)
  To: mdshahid03
  Cc: Steve French, Paulo Alcantara, Ronnie Sahlberg, Shyam Prasad N,
	Tom Talpey, Bharath SM, linux-cifs, samba-technical, linux-kernel

The patch is correct but it doesn't improve clarity and doesn't fix a bug.

Any other opinions on whether merging a patch like this?

On Fri, Jul 24, 2026 at 7:34 AM <mdshahid03@gmail.com> wrote:
>
> Hi,
>
> Gentle ping on this patch.
>
> Could you please take a look when time permits?
>
> Thanks!
>
> Mohammad Shahid
>
>


-- 
Thanks,

Steve

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

* Re: [PATCH] smb: client: remove redundant NULL check before kfree()
  2026-07-03 12:21 [PATCH] smb: client: remove redundant NULL check before kfree() mdshahid03
  2026-07-24 12:31 ` mdshahid03
@ 2026-08-21 16:40 ` Paulo Alcantara
  1 sibling, 0 replies; 4+ messages in thread
From: Paulo Alcantara @ 2026-08-21 16:40 UTC (permalink / raw)
  To: mdshahid03, Steve French, Ronnie Sahlberg, Shyam Prasad N,
	Tom Talpey, Bharath SM
  Cc: linux-cifs, samba-technical, linux-kernel, Mohammad Shahid

mdshahid03@gmail.com writes:

> From: Mohammad Shahid <mdshahid03@gmail.com>
>
> kfree() safely handles NULL pointers, so the explicit NULL check
> before calling kfree() is unnecessary.
> ...

Applied.

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

end of thread, other threads:[~2026-08-21 16:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-03 12:21 [PATCH] smb: client: remove redundant NULL check before kfree() mdshahid03
2026-07-24 12:31 ` mdshahid03
2026-07-25 16:41   ` Steve French
2026-08-21 16:40 ` Paulo Alcantara

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