nvme-auth: Use kvfree() for memory allocated with kvcalloc()
Subsystems (2)
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")
Signed-off-by Israel Rukshin <[email protected]>
Reviewed-by Max Gurtovoy <[email protected]>
--- drivers/nvme/host/auth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/auth.c +1 -1
@@ -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
Looks good:
Reviewed-by Christoph Hellwig <[email protected]>
Quoted 2 lines · Israel Rukshin
Memory allocated by
kvcalloc()may come from vmalloc or kmalloc, so usekvfree()instead ofkfree()for proper deallocation.
Thanks, applied to nvme-6.19.
Reviewed-by Sagi Grimberg <[email protected]>