Skip to contentSkip to conversation

infiniband-diags/libibnetdisc/ibnetdisc.c: Handle calloc failure

PATCH In review Hal Rosenstock 2 participants 2 messages Apr 27, 2011 1 message not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 infiniband-diags/libibnetdisc/ibnetdisc.c: Handle calloc failure

in recv_node_info

---

libibnetdisc/src/ibnetdisc.c +2 -0
index 0d3f60a..e4487c1 100644
@@ -316,6 +316,8 @@ static int recv_node_info(smp_engine_t * engine, ibnd_smp_t * smp,
 	if (!port) {
 		/* If we have not see this port before create a shell for it */
 		port = node->ports[port_num] = calloc(1, sizeof(*port));
+		if (!port)
+			return -1;
 		port->node = node;
 		port->portnum = port_num;
 	}

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 4 lines · On Wed, 27 Apr 2011 11:17:46 -0700 Hal Rosenstock…

in recv_node_info

Good catch,
Thanks, applied,
Ira

Quoted 18 lines

---

libibnetdisc/src/ibnetdisc.c +2 -1
index 0d3f60a..e4487c1 100644
@@ -316,6 +316,8 @@ static int recv_node_info(smp_engine_t * engine, ibnd_smp_t * smp,
 	if (!port) {
 		/* If we have not see this port before create a shell for it */
 		port = node->ports[port_num] = calloc(1, sizeof(*port));
+		if (!port)
+			return -1;
 		port->node = node;
 		port->portnum = port_num;
 	}
--

To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 9 lines
Ira Weiny
Math Programmer/Computer Scientist
Lawrence Livermore National Lab
925-423-8008
[email protected]
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html