public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] smb: client: Avoid redundant statements after a failed kmalloc() in SMB2_sess_auth_rawntlmssp_negotiate()
@ 2025-10-09  9:05 Markus Elfring
  0 siblings, 0 replies; only message in thread
From: Markus Elfring @ 2025-10-09  9:05 UTC (permalink / raw)
  To: linux-cifs, samba-technical, Bharath SM, Paulo Alcantara,
	Pavel Shilovsky, Ronnie Sahlberg, Sachin Prabhu, Shyam Prasad N,
	Steve French, Tom Talpey
  Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 fs/smb/client/smb2pdu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c
index 42e2d4ea344d..ff83d672aa05 100644
--- a/fs/smb/client/smb2pdu.c
+++ b/fs/smb/client/smb2pdu.c
@@ -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;
 }
-- 
2.51.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-10-09  9:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-09  9:05 [PATCH] smb: client: Avoid redundant statements after a failed kmalloc() in SMB2_sess_auth_rawntlmssp_negotiate() Markus Elfring

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