Skip to contentSkip to conversation

nvme-keyring: kbuild fixes

PATCH In review Hannes Reinecke 2 participants 6 messages Oct 1, 2025 NVMe

lore
Share & tools
lore
#0 lore raw

v2 cover nvme-keyring: kbuild fixes

Hi all,

the kbuild robot uncovered some issues when having authentication disabled. This patchset will correct them.

As usual, comments and reviews are welcome.

Hannes Reinecke (4):
nvme-keyring: use correct format specifier
nvme-keyring: typo in nvme_dhchap_psk_lookup()
nvme-fabrics: make call to nvme_auth_extract_key() conditional
nvme-keyring: fixup declaration of nvme_dhchap_psk_hash()

 drivers/nvme/common/keyring.c |  2 +-
 drivers/nvme/host/fabrics.c   | 10 ++++++++++
 include/linux/nvme-keyring.h  |  4 ++--
 3 files changed, 13 insertions(+), 3 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH v2 1/4 nvme-keyring: use correct format specifier

Use correct format specifier for pr_debug.

---
 drivers/nvme/common/keyring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/common/keyring.c +1 -1
index a58c93c6d495..1de07e8a8f73 100644
@@ -340,7 +340,7 @@ static int nvme_dhchap_psk_preparse(struct key_preparsed_payload *prep)
 		keylen = 70;
 		break;
 	default:
-		pr_debug("%s: Invalid data length %lu\n", __func__, datalen);
+		pr_debug("%s: Invalid data length %zu\n", __func__, datalen);
 		prep->payload.data[0] = NULL;
 		prep->quotalen = 0;
 		return -EINVAL;
Signature · 1 line
2.43.0
#2 lore raw

PATCH v2 2/4 nvme-keyring: typo in nvme_dhchap_psk_lookup()

In reply to Hannes Reinecke

Spurious semicolon in the function stub nvme_dhchap_psk_lookup().

---
 include/linux/nvme-keyring.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/nvme-keyring.h +1 -1
index d8baa71f061d..6115bf5cf346 100644
@@ -50,7 +50,7 @@ static inline struct key *nvme_dhchap_psk_refresh(struct key *keyring,
 	return ERR_PTR(-ENOTSUPP);
 }
 static inline struct key *nvme_dhchap_psk_lookup(struct key *keyring,
-		const char *hostnqn, const char *subnqn, u8 hmac);
+		const char *hostnqn, const char *subnqn, u8 hmac)
 {
 	return ERR_PTR(-ENOTSUPP);
 }
Signature · 1 line
2.43.0
#3 lore raw

PATCH v2 3/4 nvme-fabrics: make call to nvme_auth_extract_key() conditional

In reply to Hannes Reinecke

nvme_auth_extract_key() is only available if the authentication code is compiled in, so make it condititional on the config option.

---
 drivers/nvme/host/fabrics.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/nvme/host/fabrics.c +10 -0
index 3d4d6d8e88c4..67b2ad5ae0fd 100644
@@ -1106,6 +1106,7 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
 	}
 
 	if (host_secret) {
+#ifdef CONFIG_NVME_HOST_AUTH
 		pr_debug("lookup host identity '%s'\n", host_secret);
 		key = nvme_auth_extract_key(opts->keyring, host_secret,
 					    strlen(host_secret),
@@ -1116,8 +1117,13 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
 		}
 		pr_debug("using dhchap key %08x\n", key_serial(key));
 		opts->dhchap_key = key;
+#else
+		ret = -EINVAL;
+		goto out;
+#endif
 	}
 	if (ctrl_secret) {
+#ifdef CONFIG_NVME_HOST_AUTH
 		if (!opts->dhchap_key) {
 			ret = -EINVAL;
 			goto out;
@@ -1132,6 +1138,10 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
 		}
 		pr_debug("using dhchap ctrl key %08x\n", key_serial(key));
 		opts->dhchap_ctrl_key = key;
+#else
+		ret = -EINVAL;
+		goto out;
+#endif
 	}
 
 	if (opts->concat) {
Signature · 1 line
2.43.0
#4 lore raw

PATCH v2 4/4 nvme-keyring: fixup declaration of nvme_dhchap_psk_hash()

In reply to Hannes Reinecke

Fixup stub declaration of nvme_dhchap_psk_hash() to avoid kbuild warnings.

---
 include/linux/nvme-keyring.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/nvme-keyring.h +1 -1
index 6115bf5cf346..4bdac22b3cbb 100644
@@ -54,7 +54,7 @@ static inline struct key *nvme_dhchap_psk_lookup(struct key *keyring,
 {
 	return ERR_PTR(-ENOTSUPP);
 }
-u8 nvme_dhchap_psk_hash(struct key *key)
+static inline u8 nvme_dhchap_psk_hash(struct key *key)
 {
 	return 0;
 }
Signature · 1 line
2.43.0
Reviewed-by on the v2 series
#5 lore raw
In reply to Hannes Reinecke
Quoted 6 lines · Hannes Reinecke

Hi all,

the kbuild robot uncovered some issues when having authentication disabled. This patchset will correct them.

As usual, comments and reviews are welcome.

Ack, fixes the build issues.

Quoted 16 lines

Hannes Reinecke (4):
nvme-keyring: use correct format specifier
nvme-keyring: typo in nvme_dhchap_psk_lookup()
nvme-fabrics: make call to nvme_auth_extract_key() conditional
nvme-keyring: fixup declaration of nvme_dhchap_psk_hash()

 drivers/nvme/common/keyring.c |  2 +-
 drivers/nvme/host/fabrics.c   | 10 ++++++++++
 include/linux/nvme-keyring.h  |  4 ++--
 3 files changed, 13 insertions(+), 3 deletions(-)
Signature · 1 line
2.43.0