[PATCH] nvme-keyring: Constify struct nvme_tls_psk_priority_list

Christophe JAILLET posted 1 patch 1 week, 6 days ago
drivers/nvme/common/keyring.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] nvme-keyring: Constify struct nvme_tls_psk_priority_list
Posted by Christophe JAILLET 1 week, 6 days ago
'struct nvme_tls_psk_priority_list' is not modified in this driver.

Constifying this structure moves some data to a read-only section, so
increases overall security.

On a x86_64, with allmodconfig:
Before:
======
   text	   data	    bss	    dec	    hex	filename
   7097	   4296	     64	  11457	   2cc1	drivers/nvme/common/keyring.o

After:
=====
   text	   data	    bss	    dec	    hex	filename
   7193	   4200	     64	  11457	   2cc1	drivers/nvme/common/keyring.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only.
---
 drivers/nvme/common/keyring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/common/keyring.c b/drivers/nvme/common/keyring.c
index 32d16c53133b..43624d7713de 100644
--- a/drivers/nvme/common/keyring.c
+++ b/drivers/nvme/common/keyring.c
@@ -194,7 +194,7 @@ EXPORT_SYMBOL_GPL(nvme_tls_psk_refresh);
  * PSKs, PSKs with hash (psk_ver 1) should be preferred to PSKs without hash
  * (psk_ver 0), and SHA-384 should be preferred to SHA-256.
  */
-static struct nvme_tls_psk_priority_list {
+static const struct nvme_tls_psk_priority_list {
 	bool generated;
 	u8 psk_ver;
 	enum nvme_tcp_tls_cipher cipher;
-- 
2.55.0