Skip to contentSkip to conversation

nvme-auth: Use kvfree() for memory allocated with kvcalloc()

PATCH Applied Israel Rukshin 4 participants 4 messages Nov 23, 2025 – Nov 30, 2025

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

PATCH 1/1 nvme-auth: Use kvfree() for memory allocated with kvcalloc()

Memory allocated by kvcalloc() may come from vmalloc or kmalloc, so use kvfree() instead of kfree() for proper deallocation.

Fixes aa36d711e945 ("nvme-auth: convert dhchap_auth_list to an array")
---
 drivers/nvme/host/auth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/auth.c +1 -1
index a01178caf15b..8f3ccb317e4d 100644
@@ -1122,7 +1122,7 @@ void nvme_auth_free(struct nvme_ctrl *ctrl)
 	if (ctrl->dhchap_ctxs) {
 		for (i = 0; i < ctrl_max_dhchaps(ctrl); i++)
 			nvme_auth_free_dhchap(&ctrl->dhchap_ctxs[i]);
-		kfree(ctrl->dhchap_ctxs);
+		kvfree(ctrl->dhchap_ctxs);
 	}
 	if (ctrl->host_key) {
 		nvme_auth_free_key(ctrl->host_key);
Signature · 1 line
2.34.1
maintainer Applied
#2 lore raw
In reply to Israel Rukshin
Quoted 2 lines · Israel Rukshin

Memory allocated by kvcalloc() may come from vmalloc or kmalloc, so use kvfree() instead of kfree() for proper deallocation.

Thanks, applied to nvme-6.19.