Whamcloud - gitweb
LU-17000 ptlrpc: Use matching deallocator for cfs_expr_list_values 43/55043/3
authorArshad Hussain <arshad.hussain@aeoncomputing.com>
Wed, 8 May 2024 10:05:30 +0000 (15:35 +0530)
committerOleg Drokin <green@whamcloud.com>
Mon, 10 Jun 2024 06:12:38 +0000 (06:12 +0000)
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 <arshad.hussain@aeoncomputing.com>
Change-Id: Idfbb6be585b35f87a59ae92d0cffa85c8dff623a
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55043
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Timothy Day <timday@amazon.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/ptlrpc/service.c

index 77f8f87..d19d2f4 100644 (file)
@@ -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));
        }