Skip to contentSkip to conversation

smb: client: Avoid redundant statements after a failed kmalloc() in SMB2_sess_auth_rawntlmssp_negotiate()

PATCH New Markus Elfring 1 participant 1 message Oct 9, 2025

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

PATCH 1/1 smb: client: Avoid redundant statements after a failed kmalloc() in SMB2_sess_auth_rawntlmssp_negotiate()

From: Markus Elfring <[email protected]>
Date: Thu, 9 Oct 2025 10:55:16 +0200

Use an additional label so that statements (which are not useful after a failed kmalloc() call) can be skipped in this function implementation.

---
 fs/smb/client/smb2pdu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/smb/client/smb2pdu.c +2 -1
index 42e2d4ea344d..ff83d672aa05 100644
@@ -1724,7 +1724,7 @@ SMB2_sess_auth_rawntlmssp_negotiate(struct SMB2_sess_data *sess_data)
 	ses->ntlmssp = kmalloc(sizeof(struct ntlmssp_auth), GFP_KERNEL);
 	if (!ses->ntlmssp) {
 		rc = -ENOMEM;
-		goto out_err;
+		goto out_set_result;
 	}
 	ses->ntlmssp->sesskey_per_smbsess = true;
 
@@ -1793,6 +1793,7 @@ SMB2_sess_auth_rawntlmssp_negotiate(struct SMB2_sess_data *sess_data)
 out_err:
 	kfree_sensitive(ses->ntlmssp);
 	ses->ntlmssp = NULL;
+out_set_result:
 	sess_data->result = rc;
 	sess_data->func = NULL;
 }
Signature · 1 line
2.51.0