[PATCH 02/21] nvme-auth: common: constify static data

Eric Biggers
2026-03-02T08:01:26Z

Fully constify the dhgroup_map and hash_map arrays. Remove 'const' from
individual fields, as it is now redundant.

Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
drivers/nvme/common/auth.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/nvme/common/auth.c b/drivers/nvme/common/auth.c
index 78d751481fe31..9e5cee217ff5c 100644
--- a/drivers/nvme/common/auth.c
+++ b/drivers/nvme/common/auth.c
@@ -34,13 +34,13 @@ u32 nvme_auth_get_seqnum(void)
mutex_unlock(&nvme_dhchap_mutex);
return seqnum;
}
EXPORT_SYMBOL_GPL(nvme_auth_get_seqnum);

-static struct nvme_auth_dhgroup_map {
- const char name[16];
- const char kpp[16];
+static const struct nvme_auth_dhgroup_map {
+ char name[16];
+ char kpp[16];
} dhgroup_map[] = {
[NVME_AUTH_DHGROUP_NULL] = {
.name = "null", .kpp = "null" },
[NVME_AUTH_DHGROUP_2048] = {
.name = "ffdhe2048", .kpp = "ffdhe2048(dh)" },
@@ -85,14 +85,14 @@ u8 nvme_auth_dhgroup_id(const char *dhgroup_name)
}
return NVME_AUTH_DHGROUP_INVALID;
}
EXPORT_SYMBOL_GPL(nvme_auth_dhgroup_id);

-static struct nvme_dhchap_hash_map {
+static const struct nvme_dhchap_hash_map {
int len;
- const char hmac[15];
- const char digest[8];
+ char hmac[15];
+ char digest[8];
} hash_map[] = {
[NVME_AUTH_HASH_SHA256] = {
.len = 32,
.hmac = "hmac(sha256)",
.digest = "sha256",
--
2.53.0