Skip to contentSkip to conversation

nvmet: auth: Avoid sparse warning in nvmet_auth_sq_free()

PATCH In review Damien Le Moal 4 participants 4 messages Apr 11, 2025 – Apr 13, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvmet: auth: Avoid sparse warning in nvmet_auth_sq_free()

When compiling with C=1, the following sparse warning is generated:

auth.c:243:23: warning: Using plain integer as NULL pointer

Avoid this warning by using NULL to instead of 0 to set the sq tls_key pointer.

Fixes fa2e0f8bbc68 ("nvmet-tcp: support secure channel concatenation")
---
 drivers/nvme/target/auth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/auth.c +1 -1
index 0b0645ac5df4..cef8d77f477b 100644
@@ -240,7 +240,7 @@ void nvmet_auth_sq_free(struct nvmet_sq *sq)
 {
 	cancel_delayed_work(&sq->auth_expired_work);
 #ifdef CONFIG_NVME_TARGET_TCP_TLS
-	sq->tls_key = 0;
+	sq->tls_key = NULL;
 #endif
 	kfree(sq->dhchap_c1);
 	sq->dhchap_c1 = NULL;
Signature · 1 line
2.49.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 18 lines · Damien Le Moal

When compiling with C=1, the following sparse warning is generated:

auth.c:243:23: warning: Using plain integer as NULL pointer

Avoid this warning by using NULL to instead of 0 to set the sq tls_key pointer.

Fixes fa2e0f8bbc68 ("nvmet-tcp: support secure channel concatenation")
---
  drivers/nvme/target/auth.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/auth.c +0 -0
index 0b0645ac5df4..cef8d77f477b 100644

drivers/nvme/target/auth.c void nvmet_auth_sq_free(struct nvmet_sq *sq) · line 246

Quoted 8 lines
drivers/nvme/target/auth.c +1 -1
@@ -240,7 +240,7 @@ void nvmet_auth_sq_free(struct nvmet_sq *sq)
  {
  	cancel_delayed_work(&sq->auth_expired_work);
  #ifdef CONFIG_NVME_TARGET_TCP_TLS
-	sq->tls_key = 0;
+	sq->tls_key = NULL;
  #endif
  	kfree(sq->dhchap_c1);
  	sq->dhchap_c1 = NULL;

Tsk. Did I do that?

Cheers,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke                  Kernel Storage Architect
[email protected]                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich
Reviewed-by on v1 1/1
#2 lore raw
In reply to Damien Le Moal
Quoted 9 lines · Damien Le Moal

When compiling with C=1, the following sparse warning is generated:

auth.c:243:23: warning: Using plain integer as NULL pointer

Avoid this warning by using NULL to instead of 0 to set the sq tls_key pointer.

Fixes fa2e0f8bbc68 ("nvmet-tcp: support secure channel concatenation")

Looks good.

-ck