All of lore.kernel.org
 help / color / mirror / Atom feed
* [rdma-core/rdma-ndd] Use integer as getopt_long returns integer
@ 2017-04-25  5:49 Honggang LI
       [not found] ` <1493099392-1883-1-git-send-email-honli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Honggang LI @ 2017-04-25  5:49 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Honggang Li

From: Honggang Li <honli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

ARM chars are unsigned by default. getopt_long return 255 instead -1.
That will cause an endless loop for aarch64 platform.

Signed-off-by: Honggang Li <honli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 rdma-ndd/rdma-ndd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rdma-ndd/rdma-ndd.c b/rdma-ndd/rdma-ndd.c
index 1579a02..e7be22b 100644
--- a/rdma-ndd/rdma-ndd.c
+++ b/rdma-ndd/rdma-ndd.c
@@ -297,7 +297,7 @@ int main(int argc, char *argv[])
 			{ }
 		};
 
-		char c = getopt_long(argc, argv, "fh", long_opts, &opt_idx);
+		int c = getopt_long(argc, argv, "fh", long_opts, &opt_idx);
 		if (c == -1)
 			break;
 
-- 
1.8.3.1

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

* Re: [rdma-core/rdma-ndd] Use integer as getopt_long returns integer
       [not found] ` <1493099392-1883-1-git-send-email-honli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2017-04-25 19:47   ` Jason Gunthorpe
  2017-04-25 20:10   ` Jonathan Toppins
  2017-04-26  6:21   ` Leon Romanovsky
  2 siblings, 0 replies; 4+ messages in thread
From: Jason Gunthorpe @ 2017-04-25 19:47 UTC (permalink / raw)
  To: Honggang LI; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

On Tue, Apr 25, 2017 at 01:49:52PM +0800, Honggang LI wrote:
> From: Honggang Li <honli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> 
> ARM chars are unsigned by default. getopt_long return 255 instead -1.
> That will cause an endless loop for aarch64 platform.
>
> Signed-off-by: Honggang Li <honli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

Yep

Reviewed-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

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

* Re: [rdma-core/rdma-ndd] Use integer as getopt_long returns integer
       [not found] ` <1493099392-1883-1-git-send-email-honli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2017-04-25 19:47   ` Jason Gunthorpe
@ 2017-04-25 20:10   ` Jonathan Toppins
  2017-04-26  6:21   ` Leon Romanovsky
  2 siblings, 0 replies; 4+ messages in thread
From: Jonathan Toppins @ 2017-04-25 20:10 UTC (permalink / raw)
  To: Honggang LI, linux-rdma-u79uwXL29TY76Z2rM5mHXA

On 04/25/2017 01:49 AM, Honggang LI wrote:
> From: Honggang Li <honli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> 
> ARM chars are unsigned by default. getopt_long return 255 instead -1.
> That will cause an endless loop for aarch64 platform.
> 
> Signed-off-by: Honggang Li <honli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  rdma-ndd/rdma-ndd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/rdma-ndd/rdma-ndd.c b/rdma-ndd/rdma-ndd.c
> index 1579a02..e7be22b 100644
> --- a/rdma-ndd/rdma-ndd.c
> +++ b/rdma-ndd/rdma-ndd.c
> @@ -297,7 +297,7 @@ int main(int argc, char *argv[])
>  			{ }
>  		};
>  
> -		char c = getopt_long(argc, argv, "fh", long_opts, &opt_idx);
> +		int c = getopt_long(argc, argv, "fh", long_opts, &opt_idx);
>  		if (c == -1)
>  			break;
>  
> 

int is the return type of the function signature anyway so this was
wrong from the start.

https://linux.die.net/man/3/getopt_long

Acked-by: Jonathan Toppins <jtoppins-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
--
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] 4+ messages in thread

* Re: [rdma-core/rdma-ndd] Use integer as getopt_long returns integer
       [not found] ` <1493099392-1883-1-git-send-email-honli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  2017-04-25 19:47   ` Jason Gunthorpe
  2017-04-25 20:10   ` Jonathan Toppins
@ 2017-04-26  6:21   ` Leon Romanovsky
  2 siblings, 0 replies; 4+ messages in thread
From: Leon Romanovsky @ 2017-04-26  6:21 UTC (permalink / raw)
  To: Honggang LI; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 500 bytes --]

On Tue, Apr 25, 2017 at 01:49:52PM +0800, Honggang LI wrote:
> From: Honggang Li <honli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>
> ARM chars are unsigned by default. getopt_long return 255 instead -1.
> That will cause an endless loop for aarch64 platform.
>
> Signed-off-by: Honggang Li <honli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  rdma-ndd/rdma-ndd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/rdma-ndd/rdma-ndd.c b/rdma-ndd/rdma-ndd.c

Thanks, applied.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2017-04-26  6:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-25  5:49 [rdma-core/rdma-ndd] Use integer as getopt_long returns integer Honggang LI
     [not found] ` <1493099392-1883-1-git-send-email-honli-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-04-25 19:47   ` Jason Gunthorpe
2017-04-25 20:10   ` Jonathan Toppins
2017-04-26  6:21   ` Leon Romanovsky

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.