linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ibacm/acme: Eliminate segfault when SLID/SGID not given
@ 2012-06-04 19:19 Hefty, Sean
       [not found] ` <1828884A29C6694DAF28B7E6B8A8237346A25C2C-P5GAC/sN6hmkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Hefty, Sean @ 2012-06-04 19:19 UTC (permalink / raw)
  To: linux-rdma (linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org),
	Hefty, Sean
  Cc: Hal Rosenstock (hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org)

Problem and cause reported by Hal Rosenstock <hal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Signed-off-by: Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
 src/acme.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/acme.c b/src/acme.c
index e6ae188..0e1d4ed 100644
--- a/src/acme.c
+++ b/src/acme.c
@@ -495,7 +495,8 @@ static int resolve_lid(struct ibv_path_record *path)
 {
 	int ret;
 
-	path->slid = htons((uint16_t) atoi(src_addr));
+	if (src_addr)
+		path->slid = htons((uint16_t) atoi(src_addr));
 	path->dlid = htons((uint16_t) atoi(dest_addr));
 	path->reversible_numpath = IBV_PATH_RECORD_REVERSIBLE | 1;
 
@@ -510,10 +511,13 @@ static int resolve_gid(struct ibv_path_record *path)
 {
 	int ret;
 
-	ret = inet_pton(AF_INET6, src_addr, &path->sgid);
-	if (ret <= 0) {
-		printf("inet_pton error on source address (%s): 0x%x\n", src_addr, ret);
-		return ret ? ret : -1;
+	if (src_addr) {
+		ret = inet_pton(AF_INET6, src_addr, &path->sgid);
+		if (ret <= 0) {
+			printf("inet_pton error on source address (%s): 0x%x\n",
+			       src_addr, ret);
+			return ret ? ret : -1;
+		}
 	}
 
 	ret = inet_pton(AF_INET6, dest_addr, &path->dgid);


--
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] 2+ messages in thread

* Re: [PATCH 1/2] ibacm/acme: Eliminate segfault when SLID/SGID not given
       [not found] ` <1828884A29C6694DAF28B7E6B8A8237346A25C2C-P5GAC/sN6hmkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2012-06-05 15:21   ` Hal Rosenstock
  0 siblings, 0 replies; 2+ messages in thread
From: Hal Rosenstock @ 2012-06-05 15:21 UTC (permalink / raw)
  To: Hefty, Sean
  Cc: linux-rdma (linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org)

On 6/4/2012 3:19 PM, Hefty, Sean wrote:
> Problem and cause reported by Hal Rosenstock <hal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> Signed-off-by: Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

Thanks.

Tested-by: Hal Rosenstock <hal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

> ---
>  src/acme.c |   14 +++++++++-----
>  1 files changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/src/acme.c b/src/acme.c
> index e6ae188..0e1d4ed 100644
> --- a/src/acme.c
> +++ b/src/acme.c
> @@ -495,7 +495,8 @@ static int resolve_lid(struct ibv_path_record *path)
>  {
>  	int ret;
>  
> -	path->slid = htons((uint16_t) atoi(src_addr));
> +	if (src_addr)
> +		path->slid = htons((uint16_t) atoi(src_addr));
>  	path->dlid = htons((uint16_t) atoi(dest_addr));
>  	path->reversible_numpath = IBV_PATH_RECORD_REVERSIBLE | 1;
>  
> @@ -510,10 +511,13 @@ static int resolve_gid(struct ibv_path_record *path)
>  {
>  	int ret;
>  
> -	ret = inet_pton(AF_INET6, src_addr, &path->sgid);
> -	if (ret <= 0) {
> -		printf("inet_pton error on source address (%s): 0x%x\n", src_addr, ret);
> -		return ret ? ret : -1;
> +	if (src_addr) {
> +		ret = inet_pton(AF_INET6, src_addr, &path->sgid);
> +		if (ret <= 0) {
> +			printf("inet_pton error on source address (%s): 0x%x\n",
> +			       src_addr, ret);
> +			return ret ? ret : -1;
> +		}
>  	}
>  
>  	ret = inet_pton(AF_INET6, dest_addr, &path->dgid);
> 
> 
> 
--
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] 2+ messages in thread

end of thread, other threads:[~2012-06-05 15:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-04 19:19 [PATCH 1/2] ibacm/acme: Eliminate segfault when SLID/SGID not given Hefty, Sean
     [not found] ` <1828884A29C6694DAF28B7E6B8A8237346A25C2C-P5GAC/sN6hmkrb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2012-06-05 15:21   ` Hal Rosenstock

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).