Skip to contentSkip to conversation

smb: client: remove redundant NULL check before kfree()

PATCH Applied [email protected] 3 participants 4 messages Jul 3 – Aug 21

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 smb: client: remove redundant NULL check before kfree()

From: Mohammad Shahid <[email protected]>

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

This issue was reported by ifnullfree.cocci.

---
 fs/smb/client/ioctl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/smb/client/ioctl.c +1 -2
index 9fa743be3652..2f152d76be7d 100644
@@ -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);
Signature · 1 line
2.43.0
#1 lore raw

Hi,

Gentle ping on this patch.

Could you please take a look when time permits?

Thanks!

Mohammad Shahid

#2 lore raw

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?

Quoted 12 lines · On Fri, Jul 24, 2026 at 7:34 AM <[email protected]> wrote:

Hi,

Gentle ping on this patch.

Could you please take a look when time permits?

Thanks!

Mohammad Shahid

Signature · 3 lines
Thanks,

Steve