* [PATCH] staging: lustre: lnet: fix type warning in lib-socket.c
@ 2015-06-28 6:14 Geliang Tang
2015-06-29 8:26 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: Geliang Tang @ 2015-06-28 6:14 UTC (permalink / raw)
To: oleg.drokin, andreas.dilger, gregkh
Cc: Geliang Tang, HPDD-discuss, devel, linux-kernel
This patch fixes the following sparse warning:
drivers/staging/lustre/lnet/lnet/lib-socket.c:175:29:
warning: incorrect type in assignment (different address spaces)
expected char [noderef] <asn:1>*ifcu_buf
got char *<noident>
Signed-off-by: Geliang Tang <geliangtang@163.com>
---
drivers/staging/lustre/lnet/lnet/lib-socket.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c
index 6f7ef4c..e3d1c42 100644
--- a/drivers/staging/lustre/lnet/lnet/lib-socket.c
+++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c
@@ -172,7 +172,7 @@ lnet_ipif_enumerate(char ***namesp)
goto out0;
}
- ifc.ifc_buf = (char *)ifr;
+ ifc.ifc_buf = (char __user *)ifr;
ifc.ifc_len = nalloc * sizeof(*ifr);
rc = lnet_sock_ioctl(SIOCGIFCONF, (unsigned long)&ifc);
--
2.3.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] staging: lustre: lnet: fix type warning in lib-socket.c
2015-06-28 6:14 [PATCH] staging: lustre: lnet: fix type warning in lib-socket.c Geliang Tang
@ 2015-06-29 8:26 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2015-06-29 8:26 UTC (permalink / raw)
To: Geliang Tang
Cc: oleg.drokin, andreas.dilger, gregkh, HPDD-discuss, devel,
linux-kernel
This patch isn't the correct fix.
The lustre people need to go through and cleanup this stuff, it's not
really a good patch for a newbie to start with.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] staging: lustre: lnet: fix type warning in lib-socket.c
@ 2017-02-12 10:05 William Blough
0 siblings, 0 replies; 3+ messages in thread
From: William Blough @ 2017-02-12 10:05 UTC (permalink / raw)
To: Oleg Drokin, Andreas Dilger, James Simmons, Greg Kroah-Hartman
Cc: lustre-devel, devel, linux-kernel
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-02-12 10:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-28 6:14 [PATCH] staging: lustre: lnet: fix type warning in lib-socket.c Geliang Tang
2015-06-29 8:26 ` Dan Carpenter
-- strict thread matches above, loose matches on Subject: below --
2017-02-12 10:05 William Blough
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox