diff mbox

[09/23] verbs: Fix incorrect type of len

Message ID 1474495729-17604-10-git-send-email-jgunthorpe@obsidianresearch.com (mailing list archive)
State Accepted
Headers show

Commit Message

Jason Gunthorpe Sept. 21, 2016, 10:08 p.m. UTC
gcc remarks:

../librdmacm/examples/udpong.c:301:11: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
   if (len < 0)

len is set by:
		len = svr_recv(&msg, sizeof msg, &addr, &addrlen);

And svr_recv returns:

static ssize_t svr_recv(struct message *msg, size_t size,

So clearly len is the wrong type, and the error test does
not work.

Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
---
 librdmacm/examples/udpong.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Hefty, Sean Sept. 22, 2016, 4:02 p.m. UTC | #1
> gcc remarks:
> 
> ../librdmacm/examples/udpong.c:301:11: warning: comparison of unsigned
> expression < 0 is always false [-Wtype-limits]
>    if (len < 0)
> 
> len is set by:
> 		len = svr_recv(&msg, sizeof msg, &addr, &addrlen);
> 
> And svr_recv returns:
> 
> static ssize_t svr_recv(struct message *msg, size_t size,
> 
> So clearly len is the wrong type, and the error test does
> not work.
> 
> Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>

Acked-by: Sean Hefty <sean.hefty@intel.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/librdmacm/examples/udpong.c b/librdmacm/examples/udpong.c
index 6affc62d5a84..0f44f50e6e88 100644
--- a/librdmacm/examples/udpong.c
+++ b/librdmacm/examples/udpong.c
@@ -291,7 +291,7 @@  out:
 
 static int svr_run(void)
 {
-	size_t len;
+	ssize_t len;
 	int ret;
 
 	ret = svr_bind();