Fixed findings

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-476): [#def1]
rdma-core-55.0/infiniband-diags/ibnetdiscover.c:555:33: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘fabric’
rdma-core-55.0/infiniband-diags/ibnetdiscover.c:1060:5: enter_function: entry to ‘main’
rdma-core-55.0/infiniband-diags/ibnetdiscover.c:1113:12: branch_false: following ‘false’ branch...
 branch_false: ...to here
rdma-core-55.0/infiniband-diags/ibnetdiscover.c:1117:12: branch_false: following ‘false’ branch...
rdma-core-55.0/infiniband-diags/ibnetdiscover.c:1122:22: branch_false: ...to here
rdma-core-55.0/infiniband-diags/ibnetdiscover.c:1121:20: branch_true: following ‘true’ branch...
rdma-core-55.0/infiniband-diags/ibnetdiscover.c:1123:25: branch_true: ...to here
rdma-core-55.0/infiniband-diags/ibnetdiscover.c:1126:12: branch_false: following ‘false’ branch...
rdma-core-55.0/infiniband-diags/ibnetdiscover.c:1128:18: branch_false: ...to here
rdma-core-55.0/infiniband-diags/ibnetdiscover.c:1128:17: branch_false: following ‘false’ branch...
rdma-core-55.0/infiniband-diags/ibnetdiscover.c:1130:17: branch_false: ...to here
rdma-core-55.0/infiniband-diags/ibnetdiscover.c:1130:17: branch_false: following ‘false’ branch (when ‘diff_fabric’ is NULL)...
rdma-core-55.0/infiniband-diags/ibnetdiscover.c:1133:17: branch_false: ...to here
rdma-core-55.0/infiniband-diags/ibnetdiscover.c:1133:17: call_function: calling ‘dump_topology’ from ‘main’
#  553|   	fprintf(f, "# Initiated from node %016" PRIx64 " port %016" PRIx64 "\n",
#  554|   		fabric->from_node->guid,
#  555|-> 		mad_get_field64(fabric->from_node->info, 0,
#  556|   				IB_NODE_PORT_GUID_F));
#  557|   

Error: CPPCHECK_WARNING (CWE-476): [#def2]
rdma-core-55.0/infiniband-diags/ibtracert.c:135: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: port
#  133|   static int get_node(Node * node, Port * port, ib_portid_t * portid)
#  134|   {
#  135|-> 	void *pi = port->portinfo, *ni = node->nodeinfo, *nd = node->nodedesc;
#  136|   	char *s, *e;
#  137|   

Error: CPPCHECK_WARNING (CWE-476): [#def3]
rdma-core-55.0/infiniband-diags/ibtracert.c:435: warning[nullPointerOutOfMemory]: If memory allocation fails, then there is a possible null pointer dereference: port
#  433|   	void *pi = portinfo;
#  434|   
#  435|-> 	port->portnum = portnum;
#  436|   
#  437|   	if (!smp_query_via(pi, portid, IB_ATTR_PORT_INFO, portnum, timeout,

Error: GCC_ANALYZER_WARNING (CWE-476): [#def4]
rdma-core-55.0/libibverbs/cmd_ioctl.c:145:30: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
rdma-core-55.0/libibverbs/cmd_ioctl.c:128:5: enter_function: entry to ‘execute_ioctl’
rdma-core-55.0/libibverbs/cmd_ioctl.c:130:38: call_function: inlined call to ‘verbs_get_ctx’ from ‘execute_ioctl’
rdma-core-55.0/libibverbs/cmd_ioctl.c:135:13: branch_true: ...to here
rdma-core-55.0/libibverbs/cmd_ioctl.c:135:12: branch_false: following ‘false’ branch...
rdma-core-55.0/libibverbs/cmd_ioctl.c:140:9: branch_false: ...to here
rdma-core-55.0/libibverbs/cmd_ioctl.c:145:30: danger: dereference of NULL ‘<unknown>’
#  143|   	cmd->hdr.reserved1 = 0;
#  144|   	cmd->hdr.reserved2 = 0;
#  145|-> 	cmd->hdr.driver_id = vctx->priv->driver_id;
#  146|   
#  147|   	if (ioctl(context->cmd_fd, RDMA_VERBS_IOCTL, &cmd->hdr))

Error: GCC_ANALYZER_WARNING (CWE-401): [#def5]
rdma-core-55.0/providers/mlx5/dr_arg.c:71:27: warning[-Wanalyzer-malloc-leak]: leak of ‘arg_obj’
rdma-core-55.0/providers/mlx5/dr_arg.c:126:28: enter_function: entry to ‘dr_arg_pool_create’
rdma-core-55.0/providers/mlx5/dr_arg.c:132:12: branch_false: following ‘false’ branch (when ‘pool’ is non-NULL)...
rdma-core-55.0/providers/mlx5/dr_arg.c:137:9: branch_false: ...to here
rdma-core-55.0/providers/mlx5/dr_arg.c:143:13: call_function: calling ‘dr_arg_pool_alloc_objs’ from ‘dr_arg_pool_create’
#   69|   
#   70|   	for (i = 0; i < num_of_objects; i++) {
#   71|-> 		arg_obj = calloc(1, sizeof(struct dr_arg_pool));
#   72|   		if (!arg_obj) {
#   73|   			errno = ENOMEM;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def6]
rdma-core-55.0/providers/mthca/memfree.c:181:9: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘db_tab’
rdma-core-55.0/providers/mthca/memfree.c:176:18: acquire_memory: this call could return NULL
rdma-core-55.0/providers/mthca/memfree.c:181:9: danger: ‘db_tab’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#  179|   	pthread_mutex_init(&db_tab->mutex, NULL);
#  180|   
#  181|-> 	db_tab->npages     = npages;
#  182|   	db_tab->max_group1 = 0;
#  183|   	db_tab->min_group2 = npages - 1;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def7]
rdma-core-55.0/redhat-linux-build/include/infiniband/verbs.h:2564:16: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’
rdma-core-55.0/librdmacm/cma.c:293:13: enter_function: entry to ‘remove_cma_dev’
rdma-core-55.0/librdmacm/cma.c:301:12: branch_true: following ‘true’ branch...
rdma-core-55.0/librdmacm/cma.c:302:17: branch_true: ...to here
rdma-core-55.0/librdmacm/cma.c:302:17: call_function: calling ‘ibv_close_xrcd’ from ‘remove_cma_dev’
# 2562|   {
# 2563|   	struct verbs_context *vctx = verbs_get_ctx(xrcd->context);
# 2564|-> 	return vctx->close_xrcd(xrcd);
# 2565|   }
# 2566|   

Error: GCC_ANALYZER_WARNING (CWE-476): [#def8]
rdma-core-55.0/redhat-linux-build/pyverbs/providers/mlx5/mlx5dv_flow.c:15408:5: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘base_vtables’
rdma-core-55.0/redhat-linux-build/pyverbs/providers/mlx5/mlx5dv_flow.c:15407:29: acquire_memory: this call could return NULL
rdma-core-55.0/redhat-linux-build/pyverbs/providers/mlx5/mlx5dv_flow.c:15408:5: danger: ‘base_vtables’ could be NULL: unchecked value from [(1)](sarif:/runs/0/results/0/codeFlows/0/threadFlows/0/locations/0)
#15406|       }
#15407|       base_vtables = (void**) malloc(sizeof(void*) * (size_t)(base_depth + 1));
#15408|->     base_vtables[0] = unknown;
#15409|       for (i = 1; i < PyTuple_GET_SIZE(bases); i++) {
#15410|           void* base_vtable = __Pyx_GetVtable(((PyTypeObject*)PyTuple_GET_ITEM(bases, i)));

Scan Properties

analyzer-version-clippy1.86.0
analyzer-version-cppcheck2.17.1
analyzer-version-gcc15.0.1
analyzer-version-gcc-analyzer15.0.1
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
diffbase-analyzer-version-clippy1.86.0
diffbase-analyzer-version-cppcheck2.17.1
diffbase-analyzer-version-gcc15.0.1
diffbase-analyzer-version-gcc-analyzer15.0.1
diffbase-analyzer-version-shellcheck0.10.0
diffbase-analyzer-version-unicontrol0.0.2
diffbase-enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
diffbase-exit-code0
diffbase-hostip-172-16-1-30.us-west-2.compute.internal
diffbase-known-false-positives/usr/share/csmock/known-false-positives.js
diffbase-known-false-positives-rpmknown-false-positives-0.0.0.20250425.124705.g1c7c448.main-1.el9.noarch
diffbase-mock-configfedora-rawhide-x86_64
diffbase-project-namerdma-core-57.0-2.fc43
diffbase-store-results-to/tmp/tmpqd434krh/rdma-core-57.0-2.fc43.tar.xz
diffbase-time-created2025-04-25 15:37:58
diffbase-time-finished2025-04-25 15:42:49
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'unicontrol,cppcheck,gcc,clippy,shellcheck' '-o' '/tmp/tmpqd434krh/rdma-core-57.0-2.fc43.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpqd434krh/rdma-core-57.0-2.fc43.src.rpm'
diffbase-tool-versioncsmock-3.8.1.20250422.172604.g26bc3d6-1.el9
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-30.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20250425.124705.g1c7c448.main-1.el9.noarch
mock-configfedora-rawhide-x86_64
project-namerdma-core-55.0-1.fc42
store-results-to/tmp/tmptsjunb13/rdma-core-55.0-1.fc42.tar.xz
time-created2025-04-25 15:32:30
time-finished2025-04-25 15:37:44
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'unicontrol,cppcheck,gcc,clippy,shellcheck' '-o' '/tmp/tmptsjunb13/rdma-core-55.0-1.fc42.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmptsjunb13/rdma-core-55.0-1.fc42.src.rpm'
tool-versioncsmock-3.8.1.20250422.172604.g26bc3d6-1.el9