All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] [librdmacm] librdmacm: batch of fixes
@ 2012-10-09 12:27 Dotan Barak
       [not found] ` <1349785672-1921-1-git-send-email-dotanb-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Dotan Barak @ 2012-10-09 12:27 UTC (permalink / raw)
  To: sean.hefty-ral2JQCrhuEAvxtiuMwx3w
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Dotan Barak

Here is a small batch of fixes for librdmacm.

Dotan Barak (5):
  rsocket: add missing va_end() after calling va_end()
  rsocket: added missing break
  rstream: initialize return value in server_connect()
  rstream: added missing return is accept() failed
  rping: added checks to the return values functions

 examples/rping.c   |   21 ++++++++++++++++++---
 examples/rstream.c |    3 ++-
 src/rsocket.c      |    2 ++
 3 files changed, 22 insertions(+), 4 deletions(-)

-- 
1.7.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/5] [librdmacm] rsocket: add missing va_end() after calling va_end()
       [not found] ` <1349785672-1921-1-git-send-email-dotanb-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
@ 2012-10-09 12:27   ` Dotan Barak
  2012-10-09 12:27   ` [PATCH 2/5] [librdmacm] rsocket: added missing break Dotan Barak
                     ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Dotan Barak @ 2012-10-09 12:27 UTC (permalink / raw)
  To: sean.hefty-ral2JQCrhuEAvxtiuMwx3w
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Dotan Barak

Not doing so, may lead to resource leak.

Signed-off-by: Dotan Barak <dotanb-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
Reviewed-by: Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 src/rsocket.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/rsocket.c b/src/rsocket.c
index 4c4821b..278c8ec 100644
--- a/src/rsocket.c
+++ b/src/rsocket.c
@@ -2002,6 +2002,7 @@ int rfcntl(int socket, int cmd, ... /* arg */ )
 	va_start(args, cmd);
 	switch (cmd) {
 	case F_GETFL:
+		va_end(args);
 		return (int) rs->fd_flags;
 	case F_SETFL:
 		param = va_arg(args, long);
-- 
1.7.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/5] [librdmacm] rsocket: added missing break
       [not found] ` <1349785672-1921-1-git-send-email-dotanb-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
  2012-10-09 12:27   ` [PATCH 1/5] [librdmacm] rsocket: add missing va_end() after calling va_end() Dotan Barak
@ 2012-10-09 12:27   ` Dotan Barak
  2012-10-09 12:27   ` [PATCH 3/5] [librdmacm] rstream: initialize return value in server_connect() Dotan Barak
                     ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Dotan Barak @ 2012-10-09 12:27 UTC (permalink / raw)
  To: sean.hefty-ral2JQCrhuEAvxtiuMwx3w
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Dotan Barak

Signed-off-by: Dotan Barak <dotanb-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
Reviewed-by: Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 src/rsocket.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/rsocket.c b/src/rsocket.c
index 278c8ec..4665ce7 100644
--- a/src/rsocket.c
+++ b/src/rsocket.c
@@ -1859,6 +1859,7 @@ int rsetsockopt(int socket, int level, int optname,
 		default:
 			break;
 		}
+		break;
 	case SOL_RDMA:
 		if (rs->state >= rs_opening) {
 			ret = ERR(EINVAL);
-- 
1.7.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/5] [librdmacm] rstream: initialize return value in server_connect()
       [not found] ` <1349785672-1921-1-git-send-email-dotanb-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
  2012-10-09 12:27   ` [PATCH 1/5] [librdmacm] rsocket: add missing va_end() after calling va_end() Dotan Barak
  2012-10-09 12:27   ` [PATCH 2/5] [librdmacm] rsocket: added missing break Dotan Barak
@ 2012-10-09 12:27   ` Dotan Barak
  2012-10-09 12:27   ` [PATCH 4/5] [librdmacm] rstream: added missing return is accept() failed Dotan Barak
                     ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Dotan Barak @ 2012-10-09 12:27 UTC (permalink / raw)
  To: sean.hefty-ral2JQCrhuEAvxtiuMwx3w
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Dotan Barak

If use_async == 0 and rs_accept() passes (i.e. non negative value), then
the return value from the function was uninitialized.

Signed-off-by: Dotan Barak <dotanb-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
Reviewed-by: Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 examples/rstream.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/examples/rstream.c b/examples/rstream.c
index 1d221d0..6ef60a1 100644
--- a/examples/rstream.c
+++ b/examples/rstream.c
@@ -444,7 +444,7 @@ free:
 static int server_connect(void)
 {
 	struct pollfd fds;
-	int ret;
+	int ret = 0;
 
 	set_options(lrs);
 	do {
-- 
1.7.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/5] [librdmacm] rstream: added missing return is accept() failed
       [not found] ` <1349785672-1921-1-git-send-email-dotanb-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
                     ` (2 preceding siblings ...)
  2012-10-09 12:27   ` [PATCH 3/5] [librdmacm] rstream: initialize return value in server_connect() Dotan Barak
@ 2012-10-09 12:27   ` Dotan Barak
  2012-10-09 12:27   ` [PATCH 5/5] [librdmacm] rping: added checks to the return values functions Dotan Barak
  2012-10-09 18:29   ` [PATCH 0/5] [librdmacm] librdmacm: batch of fixes Hefty, Sean
  5 siblings, 0 replies; 7+ messages in thread
From: Dotan Barak @ 2012-10-09 12:27 UTC (permalink / raw)
  To: sean.hefty-ral2JQCrhuEAvxtiuMwx3w
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Dotan Barak, Yishai Hadas

Signed-off-by: Dotan Barak <dotanb-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
Signed-off-by: Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 examples/rstream.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/examples/rstream.c b/examples/rstream.c
index 6ef60a1..d65c48d 100644
--- a/examples/rstream.c
+++ b/examples/rstream.c
@@ -464,6 +464,7 @@ static int server_connect(void)
 	if (rs < 0) {
 		ret = rs;
 		perror("raccept");
+		return ret;
 	}
 
 	if (use_fork)
-- 
1.7.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/5] [librdmacm] rping: added checks to the return values functions
       [not found] ` <1349785672-1921-1-git-send-email-dotanb-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
                     ` (3 preceding siblings ...)
  2012-10-09 12:27   ` [PATCH 4/5] [librdmacm] rstream: added missing return is accept() failed Dotan Barak
@ 2012-10-09 12:27   ` Dotan Barak
  2012-10-09 18:29   ` [PATCH 0/5] [librdmacm] librdmacm: batch of fixes Hefty, Sean
  5 siblings, 0 replies; 7+ messages in thread
From: Dotan Barak @ 2012-10-09 12:27 UTC (permalink / raw)
  To: sean.hefty-ral2JQCrhuEAvxtiuMwx3w
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Dotan Barak

This will make rping to exit with return value other than zero in case of an
error.

Signed-off-by: Dotan Barak <dotanb-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
Reviewed-by: Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 examples/rping.c |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/examples/rping.c b/examples/rping.c
index 32bd70a..d702592 100644
--- a/examples/rping.c
+++ b/examples/rping.c
@@ -881,7 +881,14 @@ static int rping_run_server(struct rping_cb *cb)
 		goto err2;
 	}
 
-	rping_test_server(cb);
+	ret = rping_test_server(cb);
+	if (ret) {
+		fprintf(stderr, "rping server failed: %d\n", ret);
+		goto err3;
+	}
+
+	ret = 0;
+err3:
 	rdma_disconnect(cb->child_cm_id);
 	pthread_join(cb->cqthread, NULL);
 	rdma_destroy_id(cb->child_cm_id);
@@ -1049,7 +1056,14 @@ static int rping_run_client(struct rping_cb *cb)
 		goto err2;
 	}
 
-	rping_test_client(cb);
+	ret = rping_test_client(cb);
+	if (ret) {
+		fprintf(stderr, "rping client failed: %d\n", ret);
+		goto err3;
+	}
+
+	ret = 0;
+err3:
 	rdma_disconnect(cb->cm_id);
 	pthread_join(cb->cqthread, NULL);
 err2:
@@ -1189,6 +1203,7 @@ int main(int argc, char *argv[])
 	cb->cm_channel = rdma_create_event_channel();
 	if (!cb->cm_channel) {
 		perror("rdma_create_event_channel");
+		ret = ENOMEM;
 		goto out;
 	}
 
@@ -1210,7 +1225,7 @@ int main(int argc, char *argv[])
 		ret = rping_run_client(cb);
 
 	DEBUG_LOG("destroy cm_id %p\n", cb->cm_id);
-	rdma_destroy_id(cb->cm_id);
+	ret = rdma_destroy_id(cb->cm_id);
 out2:
 	rdma_destroy_event_channel(cb->cm_channel);
 out:
-- 
1.7.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* RE: [PATCH 0/5] [librdmacm] librdmacm: batch of fixes
       [not found] ` <1349785672-1921-1-git-send-email-dotanb-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
                     ` (4 preceding siblings ...)
  2012-10-09 12:27   ` [PATCH 5/5] [librdmacm] rping: added checks to the return values functions Dotan Barak
@ 2012-10-09 18:29   ` Hefty, Sean
  5 siblings, 0 replies; 7+ messages in thread
From: Hefty, Sean @ 2012-10-09 18:29 UTC (permalink / raw)
  To: Dotan Barak; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

thanks!

Applied all, but with a couple of minor adjustments.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-10-09 18:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-09 12:27 [PATCH 0/5] [librdmacm] librdmacm: batch of fixes Dotan Barak
     [not found] ` <1349785672-1921-1-git-send-email-dotanb-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2012-10-09 12:27   ` [PATCH 1/5] [librdmacm] rsocket: add missing va_end() after calling va_end() Dotan Barak
2012-10-09 12:27   ` [PATCH 2/5] [librdmacm] rsocket: added missing break Dotan Barak
2012-10-09 12:27   ` [PATCH 3/5] [librdmacm] rstream: initialize return value in server_connect() Dotan Barak
2012-10-09 12:27   ` [PATCH 4/5] [librdmacm] rstream: added missing return is accept() failed Dotan Barak
2012-10-09 12:27   ` [PATCH 5/5] [librdmacm] rping: added checks to the return values functions Dotan Barak
2012-10-09 18:29   ` [PATCH 0/5] [librdmacm] librdmacm: batch of fixes Hefty, Sean

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.