Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1579185 > unrolled thread

[PATCH] staging: lustre: lnet: fix type warning in lib-socket.c

Started byWilliam Blough <devel@blough.us>
First post2017-02-12 11:10 +0100
Last post2017-02-12 11:10 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] staging: lustre: lnet: fix type warning in lib-socket.c William Blough <devel@blough.us> - 2017-02-12 11:10 +0100

#1579185 — [PATCH] staging: lustre: lnet: fix type warning in lib-socket.c

FromWilliam Blough <devel@blough.us>
Date2017-02-12 11:10 +0100
Subject[PATCH] staging: lustre: lnet: fix type warning in lib-socket.c
Message-ID<t9Zgt-4Za-3@gated-at.bofh.it>
The local socket address is defined as a __be32 value.  However, if the
local ip address is not given, then the constant INADDR_ANY is used.

This patch converts INADDR_ANY to __be32 for type consistency.

Fixes the following sparse warnings:

drivers/staging/lustre/lnet/lnet/lib-socket.c:396:41: warning:
 incorrect type in assignment (different base types)
drivers/staging/lustre/lnet/lnet/lib-socket.c:397:56: warning:
 restricted __be32 degrades to integer

Signed-off-by: William Blough <devel@blough.us>
---
 drivers/staging/lustre/lnet/lnet/lib-socket.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c
index 654a7b2..b7b87ec 100644
--- a/drivers/staging/lustre/lnet/lnet/lib-socket.c
+++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c
@@ -393,8 +393,10 @@ lnet_sock_create(struct socket **sockp, int *fatal, __u32 local_ip,
 		memset(&locaddr, 0, sizeof(locaddr));
 		locaddr.sin_family = AF_INET;
 		locaddr.sin_port = htons(local_port);
-		locaddr.sin_addr.s_addr = !local_ip ?
-					  INADDR_ANY : htonl(local_ip);
+		if (!local_ip)
+			locaddr.sin_addr.s_addr = htonl(INADDR_ANY);
+		else
+			locaddr.sin_addr.s_addr = htonl(local_ip);
 
 		rc = kernel_bind(sock, (struct sockaddr *)&locaddr,
 				 sizeof(locaddr));
-- 
2.1.4

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web