@@ -120,11 +120,8 @@ static int res_cm_id_line(struct rd *rd, const char *name, int idx,
char *comm = NULL;
if (!nla_line[RDMA_NLDEV_ATTR_RES_STATE] ||
- !nla_line[RDMA_NLDEV_ATTR_RES_PS] ||
- (!nla_line[RDMA_NLDEV_ATTR_RES_PID] &&
- !nla_line[RDMA_NLDEV_ATTR_RES_KERN_NAME])) {
+ !nla_line[RDMA_NLDEV_ATTR_RES_PS])
return MNL_CB_ERROR;
- }
if (nla_line[RDMA_NLDEV_ATTR_PORT_INDEX])
port = mnl_attr_get_u32(nla_line[RDMA_NLDEV_ATTR_PORT_INDEX]);
@@ -56,11 +56,8 @@ static int res_cq_line(struct rd *rd, const char *name, int idx,
uint32_t cqe;
if (!nla_line[RDMA_NLDEV_ATTR_RES_CQE] ||
- !nla_line[RDMA_NLDEV_ATTR_RES_USECNT] ||
- (!nla_line[RDMA_NLDEV_ATTR_RES_PID] &&
- !nla_line[RDMA_NLDEV_ATTR_RES_KERN_NAME])) {
+ !nla_line[RDMA_NLDEV_ATTR_RES_USECNT])
return MNL_CB_ERROR;
- }
cqe = mnl_attr_get_u32(nla_line[RDMA_NLDEV_ATTR_RES_CQE]);
@@ -17,11 +17,8 @@ static int res_mr_line(struct rd *rd, const char *name, int idx,
uint32_t mrn = 0;
uint32_t pid = 0;
- if (!nla_line[RDMA_NLDEV_ATTR_RES_MRLEN] ||
- (!nla_line[RDMA_NLDEV_ATTR_RES_PID] &&
- !nla_line[RDMA_NLDEV_ATTR_RES_KERN_NAME])) {
+ if (!nla_line[RDMA_NLDEV_ATTR_RES_MRLEN])
return MNL_CB_ERROR;
- }
if (nla_line[RDMA_NLDEV_ATTR_RES_RKEY])
rkey = mnl_attr_get_u32(nla_line[RDMA_NLDEV_ATTR_RES_RKEY]);
@@ -17,11 +17,8 @@ static int res_pd_line(struct rd *rd, const char *name, int idx,
uint32_t pdn = 0;
uint64_t users;
- if (!nla_line[RDMA_NLDEV_ATTR_RES_USECNT] ||
- (!nla_line[RDMA_NLDEV_ATTR_RES_PID] &&
- !nla_line[RDMA_NLDEV_ATTR_RES_KERN_NAME])) {
+ if (!nla_line[RDMA_NLDEV_ATTR_RES_USECNT])
return MNL_CB_ERROR;
- }
if (nla_line[RDMA_NLDEV_ATTR_RES_LOCAL_DMA_LKEY])
local_dma_lkey = mnl_attr_get_u32(
@@ -90,11 +90,8 @@ static int res_qp_line(struct rd *rd, const char *name, int idx,
if (!nla_line[RDMA_NLDEV_ATTR_RES_LQPN] ||
!nla_line[RDMA_NLDEV_ATTR_RES_SQ_PSN] ||
!nla_line[RDMA_NLDEV_ATTR_RES_TYPE] ||
- !nla_line[RDMA_NLDEV_ATTR_RES_STATE] ||
- (!nla_line[RDMA_NLDEV_ATTR_RES_PID] &&
- !nla_line[RDMA_NLDEV_ATTR_RES_KERN_NAME])) {
+ !nla_line[RDMA_NLDEV_ATTR_RES_STATE])
return MNL_CB_ERROR;
- }
if (nla_line[RDMA_NLDEV_ATTR_PORT_INDEX])
port = mnl_attr_get_u32(nla_line[RDMA_NLDEV_ATTR_PORT_INDEX]);
@@ -211,6 +211,9 @@ char *get_task_name(uint32_t pid)
char *comm;
FILE *f;
+ if (!pid)
+ return NULL;
+
if (asprintf(&comm, "/proc/%d/comm", pid) < 0)
return NULL;