mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] stating: lustre: fix sparse error: incompatible types in comparison expression
@ 2017-07-13  2:10 Rui Teng
  2017-07-13  4:29 ` Oleg Drokin
  0 siblings, 1 reply; 2+ messages in thread
From: Rui Teng @ 2017-07-13  2:10 UTC (permalink / raw)
  To: Oleg Drokin, Andreas Dilger, James Simmons, Greg Kroah-Hartman
  Cc: lustre-devel, devel, linux-kernel, Rui Teng

Comparing two user space addresses to avoid sparse error:

drivers/staging//lustre/lnet/selftest/conrpc.c:490:30: error:
incompatible types in comparison expression (different address spaces)

Signed-off-by: Rui Teng <rui.teng@linux.vnet.ibm.com>
---
 drivers/staging/lustre/lnet/selftest/conrpc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c
index da36c55b86d3..ae7c2772825e 100644
--- a/drivers/staging/lustre/lnet/selftest/conrpc.c
+++ b/drivers/staging/lustre/lnet/selftest/conrpc.c
@@ -487,10 +487,9 @@ lstcon_rpc_trans_interpreter(struct lstcon_rpc_trans *trans,
 				   sizeof(struct list_head)))
 			return -EFAULT;
 
-		if (tmp.next == head_up)
-			return 0;
-
 		next = tmp.next;
+		if (next == head_up)
+			return 0;
 
 		ent = list_entry(next, struct lstcon_rpc_ent, rpe_link);
 
-- 
2.11.0

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

* Re: [PATCH] stating: lustre: fix sparse error: incompatible types in comparison expression
  2017-07-13  2:10 [PATCH] stating: lustre: fix sparse error: incompatible types in comparison expression Rui Teng
@ 2017-07-13  4:29 ` Oleg Drokin
  0 siblings, 0 replies; 2+ messages in thread
From: Oleg Drokin @ 2017-07-13  4:29 UTC (permalink / raw)
  To: Rui Teng
  Cc: Andreas Dilger, James Simmons, Greg Kroah-Hartman, lustre-devel,
	devel, linux-kernel


On Jul 12, 2017, at 10:10 PM, Rui Teng wrote:

> Comparing two user space addresses to avoid sparse error:
> 
> drivers/staging//lustre/lnet/selftest/conrpc.c:490:30: error:
> incompatible types in comparison expression (different address spaces)
> 
> Signed-off-by: Rui Teng <rui.teng@linux.vnet.ibm.com>
> ---
> drivers/staging/lustre/lnet/selftest/conrpc.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c b/drivers/staging/lustre/lnet/selftest/conrpc.c
> index da36c55b86d3..ae7c2772825e 100644
> --- a/drivers/staging/lustre/lnet/selftest/conrpc.c
> +++ b/drivers/staging/lustre/lnet/selftest/conrpc.c
> @@ -487,10 +487,9 @@ lstcon_rpc_trans_interpreter(struct lstcon_rpc_trans *trans,
> 				   sizeof(struct list_head)))
> 			return -EFAULT;
> 
> -		if (tmp.next == head_up)
> -			return 0;
> -
> 		next = tmp.next;

So the assignment is fine, but comparison is not? Strange.

I guess this is fine by me if that makes the warning go away.

Acked-by: Oleg Drokin <oleg.drokin@intel.com>

> +		if (next == head_up)
> +			return 0;
> 
> 		ent = list_entry(next, struct lstcon_rpc_ent, rpe_link);
> 
> -- 
> 2.11.0

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

end of thread, other threads:[~2017-07-13  4:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-13  2:10 [PATCH] stating: lustre: fix sparse error: incompatible types in comparison expression Rui Teng
2017-07-13  4:29 ` Oleg Drokin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®