From dccb85fcb80f9536cbb5d54030d3c1d141635603 Mon Sep 17 00:00:00 2001 From: Arshad Hussain Date: Wed, 8 May 2024 15:35:30 +0530 Subject: [PATCH] LU-17000 ptlrpc: Use matching deallocator for cfs_expr_list_values For cfs_expr_list_values() allocator use cfs_expr_list_values_free() as deallocator. Coverity actually complained that kfree() should not be called but free() should be called instead. It looks like coverity is checking under file libcfs/libcfs/util/string.c function cfs_expr_list_values which is calling calloc(). This cannot be correct under ptlrpc Test-Parameters: trivial CoverityID: 424700 ("Incorrect deallocator used") Signed-off-by: Arshad Hussain Change-Id: Idfbb6be585b35f87a59ae92d0cffa85c8dff623a Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55043 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Timothy Day Reviewed-by: Oleg Drokin --- lustre/ptlrpc/service.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index 77f8f87..d19d2f4 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -749,8 +749,6 @@ struct ptlrpc_service *ptlrpc_register_service(struct ptlrpc_service_conf *conf, if (rc <= 0) { CERROR("%s: failed to parse CPT array %s: %d\n", conf->psc_name, cconf->cc_pattern, rc); - if (cpts != NULL) - OBD_FREE_PTR_ARRAY(cpts, ncpts); RETURN(ERR_PTR(rc < 0 ? rc : -EINVAL)); } ncpts = rc; @@ -760,7 +758,7 @@ struct ptlrpc_service *ptlrpc_register_service(struct ptlrpc_service_conf *conf, OBD_ALLOC(service, offsetof(struct ptlrpc_service, srv_parts[ncpts])); if (service == NULL) { if (cpts != NULL) - OBD_FREE_PTR_ARRAY(cpts, ncpts); + cfs_expr_list_values_free(cpts, ncpts); RETURN(ERR_PTR(-ENOMEM)); } -- 1.8.3.1