diff mbox series

Minor cleanup patch - and question about returning -ENOSYS

Message ID CAH2r5muqSPutkdHgmBNQbUh=YQVr+7N4tV4GVM2hWa2ZsQHaqQ@mail.gmail.com (mailing list archive)
State New, archived
Headers show
Series Minor cleanup patch - and question about returning -ENOSYS | expand

Commit Message

Steve French Nov. 7, 2023, 4:42 a.m. UTC
Attached is another minor cleanup of comments pointed out by checkpatch ...
but checkpatch also complains about these two places in sess.c (see
below in select_sec function) where we return -ENOSYS (since
apparently it can only be returned for invalid syscall). Any thoughts?

static int select_sec(struct sess_data *sess_data)
{
        int type;
        struct cifs_ses *ses = sess_data->ses;
        struct TCP_Server_Info *server = sess_data->server;

        type = cifs_select_sectype(server, ses->sectype);
        cifs_dbg(FYI, "sess setup type %d\n", type);
        if (type == Unspecified) {
                cifs_dbg(VFS, "Unable to select appropriate
authentication method!\n");
                return -EINVAL;
        }

        switch (type) {
        case NTLMv2:
                sess_data->func = sess_auth_ntlmv2;
                break;
        case Kerberos:
#ifdef CONFIG_CIFS_UPCALL
                sess_data->func = sess_auth_kerberos;
                break;
#else
                cifs_dbg(VFS, "Kerberos negotiated but upcall support
disabled!\n");
                return -ENOSYS;
#endif /* CONFIG_CIFS_UPCALL */
        case RawNTLMSSP:
                sess_data->func = sess_auth_rawntlmssp_negotiate;
                break;
        default:
                cifs_dbg(VFS, "secType %d not supported!\n", type);
                return -ENOSYS;
        }
diff mbox series

Patch

From 0bffeed013ec84084bc5090b377d2183efa8d72b Mon Sep 17 00:00:00 2001
From: Steve French <stfrench@microsoft.com>
Date: Mon, 6 Nov 2023 22:40:38 -0600
Subject: [PATCH] smb3: more minor cleanups for session handling routines

Some trivial cleanup pointed out by checkpatch

Signed-off-by: Steve French <stfrench@microsoft.com>
---
 fs/smb/client/sess.c | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/fs/smb/client/sess.c b/fs/smb/client/sess.c
index 9d71c23fe234..6fd074fcae5b 100644
--- a/fs/smb/client/sess.c
+++ b/fs/smb/client/sess.c
@@ -812,8 +812,7 @@  static void ascii_ssetup_strings(char **pbcc_area, struct cifs_ses *ses,
 		if (WARN_ON_ONCE(len < 0))
 			len = CIFS_MAX_DOMAINNAME_LEN - 1;
 		bcc_ptr += len;
-	} /* else we will send a null domain name
-	     so the server will default to its own domain */
+	} /* else we send a null domain name so server will default to its own domain */
 	*bcc_ptr = 0;
 	bcc_ptr++;
 
@@ -909,11 +908,14 @@  static void decode_ascii_ssetup(char **pbcc_area, __u16 bleft,
 	if (len > bleft)
 		return;
 
-	/* No domain field in LANMAN case. Domain is
-	   returned by old servers in the SMB negprot response */
-	/* BB For newer servers which do not support Unicode,
-	   but thus do return domain here we could add parsing
-	   for it later, but it is not very important */
+	/*
+	 * No domain field in LANMAN case. Domain is
+	 * returned by old servers in the SMB negprot response
+	 *
+	 * BB For newer servers which do not support Unicode,
+	 * but thus do return domain here, we could add parsing
+	 * for it later, but it is not very important
+	 */
 	cifs_dbg(FYI, "ascii: bytes left %d\n", bleft);
 }
 #endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */
@@ -969,9 +971,12 @@  int decode_ntlmssp_challenge(char *bcc_ptr, int blob_len,
 	ses->ntlmssp->server_flags = server_flags;
 
 	memcpy(ses->ntlmssp->cryptkey, pblob->Challenge, CIFS_CRYPTO_KEY_SIZE);
-	/* In particular we can examine sign flags */
-	/* BB spec says that if AvId field of MsvAvTimestamp is populated then
-		we must set the MIC field of the AUTHENTICATE_MESSAGE */
+	/*
+	 * In particular we can examine sign flags
+	 *
+	 * BB spec says that if AvId field of MsvAvTimestamp is populated then
+	 * we must set the MIC field of the AUTHENTICATE_MESSAGE
+	 */
 
 	tioffset = le32_to_cpu(pblob->TargetInfoArray.BufferOffset);
 	tilen = le16_to_cpu(pblob->TargetInfoArray.Length);
-- 
2.39.2