summaryrefslogtreecommitdiff
path: root/ctdb/ib
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2009-05-20 12:08:13 +0200
committerRonnie Sahlberg <ronniesahlberg@gmail.com>2009-05-21 11:22:21 +1000
commit2fcedf6dac9dd275adbb0017e53547614df29d93 (patch)
tree94a290c1514cd2446139e31a6403466018355f73 /ctdb/ib
parent11988fc77a06c50c251acec1dc8cc2c275f68310 (diff)
downloadsamba-2fcedf6dac9dd275adbb0017e53547614df29d93.tar.gz
add missing checks on so far ignored return values
Most of these were found during a review by Jim Meyering <meyering@redhat.com> (This used to be ctdb commit 3aee5ee1deb4a19be3bd3a4ce3abbe09de763344)
Diffstat (limited to 'ctdb/ib')
-rw-r--r--ctdb/ib/ibw_ctdb.c1
-rw-r--r--ctdb/ib/ibw_ctdb_init.c8
-rw-r--r--ctdb/ib/ibwrapper.c4
-rw-r--r--ctdb/ib/ibwrapper_test.c2
4 files changed, 13 insertions, 2 deletions
diff --git a/ctdb/ib/ibw_ctdb.c b/ctdb/ib/ibw_ctdb.c
index fd577ffdce4..05541ada810 100644
--- a/ctdb/ib/ibw_ctdb.c
+++ b/ctdb/ib/ibw_ctdb.c
@@ -166,6 +166,7 @@ int ctdb_ibw_receive_handler(struct ibw_conn *conn, void *buf, int n)
* and being reused for next receive
* noticed that HL requires talloc-ed memory to be stolen */
buf2 = talloc_zero_size(conn, n);
+ if (buf2 == NULL) return -1;
memcpy(buf2, buf, n);
ctdb->upcalls->recv_pkt(ctdb, (uint8_t *)buf2, (uint32_t)n);
diff --git a/ctdb/ib/ibw_ctdb_init.c b/ctdb/ib/ibw_ctdb_init.c
index 2f4fbfe3f26..fa2ddda5aff 100644
--- a/ctdb/ib/ibw_ctdb_init.c
+++ b/ctdb/ib/ibw_ctdb_init.c
@@ -164,7 +164,15 @@ static int ctdb_ibw_queue_pkt(struct ctdb_node *node, uint8_t *data, uint32_t le
rc = ctdb_ibw_send_pkt(cn->conn, data, length);
} else {
struct ctdb_ibw_msg *p = talloc_zero(cn, struct ctdb_ibw_msg);
+ if (p == NULL) {
+ DEBUG(DEBUG_ERR, ("talloc_zero failed.\n"));
+ return -1;
+ }
p->data = talloc_memdup(p, data, length);
+ if (p->data == NULL) {
+ DEBUG(DEBUG_ERR, ("talloc_memdup failed.\n"));
+ return -1;
+ }
p->length = length;
DLIST_ADD_AFTER(cn->queue, p, cn->queue_last);
diff --git a/ctdb/ib/ibwrapper.c b/ctdb/ib/ibwrapper.c
index 5a166e5353f..6a557cbb4de 100644
--- a/ctdb/ib/ibwrapper.c
+++ b/ctdb/ib/ibwrapper.c
@@ -852,7 +852,7 @@ static int ibw_wc_recv(struct ibw_conn *conn, struct ibv_wc *wc)
}
if (part->to_read==0) {
- pctx->receive_func(conn, part->buf, part->len);
+ if(pctx->receive_func(conn, part->buf, part->len)) goto error;
part->len = 0; /* tells not having partial data (any more) */
if (ibw_wc_mem_threshold(pconn, part, pctx->opts.recv_threshold))
goto error;
@@ -867,7 +867,7 @@ static int ibw_wc_recv(struct ibw_conn *conn, struct ibv_wc *wc)
/* mostly awaited case: */
if (msglen<=remain) {
- pctx->receive_func(conn, p, msglen);
+ if(pctx->receive_func(conn, p, msglen)) goto error;
p += msglen;
remain -= msglen;
} else {
diff --git a/ctdb/ib/ibwrapper_test.c b/ctdb/ib/ibwrapper_test.c
index cbd4f431738..b9c80ae2ae2 100644
--- a/ctdb/ib/ibwrapper_test.c
+++ b/ctdb/ib/ibwrapper_test.c
@@ -486,6 +486,7 @@ int ibwtest_getdests(struct ibwtest_ctx *tcx, char op)
char *tmp;
tmp = talloc_strdup(tcx, optarg);
+ if (tmp == NULL) return -1;
/* hack to reuse the above ibw_initattr parser */
if (ibwtest_parse_attrs(tcx, tmp, &attrs, &tcx->naddrs, op))
return -1;
@@ -567,6 +568,7 @@ int main(int argc, char *argv[])
break;
case 'o':
tcx->opts = talloc_strdup(tcx, optarg);
+ if (tcx->opts) goto cleanup;
if (ibwtest_parse_attrs(tcx, tcx->opts, &tcx->attrs,
&tcx->nattrs, op))
goto cleanup;