linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH resend] staging, lustre: fix a sparse error
@ 2014-10-09 10:25 WANG Chao
  2014-10-09 12:28 ` Sudip Mukherjee
  0 siblings, 1 reply; 5+ messages in thread
From: WANG Chao @ 2014-10-09 10:25 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Al Viro, Masaru Nomura, Peng Tao, Chi Pham,
	Fredrick John Berchmans, David S. Miller,
	open list:STAGING SUBSYSTEM, open list

This fixes the following sparse error:

drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c:393:9: error:
incompatible types in comparison expression (different address spaces)

Signed-off-by: WANG Chao <wangchao19890207@gmail.com>
---
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c
index 245c9d7..1510594 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c
@@ -390,7 +390,7 @@ ksocknal_lib_csum_tx(ksock_tx_t *tx)
 	__u32	csum;
 	void	*base;
 
-	LASSERT(tx->tx_iov[0].iov_base == (void *)&tx->tx_msg);
+	LASSERT((void __force *) tx->tx_iov[0].iov_base == (void *)&tx->tx_msg);
 	LASSERT(tx->tx_conn != NULL);
 	LASSERT(tx->tx_conn->ksnc_proto == &ksocknal_protocol_v2x);
 
-- 
1.9.3


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

* Re: [PATCH resend] staging, lustre: fix a sparse error
  2014-10-09 10:25 [PATCH resend] staging, lustre: fix a sparse error WANG Chao
@ 2014-10-09 12:28 ` Sudip Mukherjee
  2014-10-10  3:21   ` WANG Chao
  0 siblings, 1 reply; 5+ messages in thread
From: Sudip Mukherjee @ 2014-10-09 12:28 UTC (permalink / raw)
  To: WANG Chao
  Cc: Greg Kroah-Hartman, Al Viro, Masaru Nomura, Peng Tao, Chi Pham,
	Fredrick John Berchmans, David S. Miller,
	open list:STAGING SUBSYSTEM, open list

On Thu, Oct 09, 2014 at 06:25:10PM +0800, WANG Chao wrote:
> This fixes the following sparse error:
> 
> drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c:393:9: error:
> incompatible types in comparison expression (different address spaces)
> 
> Signed-off-by: WANG Chao <wangchao19890207@gmail.com>
> ---
>  drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c
> index 245c9d7..1510594 100644
> --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c
> +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c
> @@ -390,7 +390,7 @@ ksocknal_lib_csum_tx(ksock_tx_t *tx)
>  	__u32	csum;
>  	void	*base;
>  
> -	LASSERT(tx->tx_iov[0].iov_base == (void *)&tx->tx_msg);
> +	LASSERT((void __force *) tx->tx_iov[0].iov_base == (void *)&tx->tx_msg);
is it ok? are you not just suppressing the sparse error?
iov_base is void __user *  

thanks
sudip

>  	LASSERT(tx->tx_conn != NULL);
>  	LASSERT(tx->tx_conn->ksnc_proto == &ksocknal_protocol_v2x);
>  
> -- 
> 1.9.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

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

* Re: [PATCH resend] staging, lustre: fix a sparse error
  2014-10-09 12:28 ` Sudip Mukherjee
@ 2014-10-10  3:21   ` WANG Chao
  2014-10-12 19:17     ` Al Viro
  0 siblings, 1 reply; 5+ messages in thread
From: WANG Chao @ 2014-10-10  3:21 UTC (permalink / raw)
  To: Sudip Mukherjee
  Cc: Greg Kroah-Hartman, Al Viro, Masaru Nomura, Peng Tao, Chi Pham,
	Fredrick John Berchmans, David S. Miller,
	open list:STAGING SUBSYSTEM, open list

On 10/09/14 at 05:58pm, Sudip Mukherjee wrote:
> On Thu, Oct 09, 2014 at 06:25:10PM +0800, WANG Chao wrote:
> > This fixes the following sparse error:
> > 
> > drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c:393:9: error:
> > incompatible types in comparison expression (different address spaces)
> > 
> > Signed-off-by: WANG Chao <wangchao19890207@gmail.com>
> > ---
> >  drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c
> > index 245c9d7..1510594 100644
> > --- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c
> > +++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c
> > @@ -390,7 +390,7 @@ ksocknal_lib_csum_tx(ksock_tx_t *tx)
> >  	__u32	csum;
> >  	void	*base;
> >  
> > -	LASSERT(tx->tx_iov[0].iov_base == (void *)&tx->tx_msg);
> > +	LASSERT((void __force *) tx->tx_iov[0].iov_base == (void *)&tx->tx_msg);
> is it ok? are you not just suppressing the sparse error?
> iov_base is void __user *  

I think __user annotation is for no dereferencing in kernel space. In
this case, I think it's fine to override this error by __force. Because
they're pointers with identical target types.

Thanks
WANG Chao

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

* Re: [PATCH resend] staging, lustre: fix a sparse error
  2014-10-10  3:21   ` WANG Chao
@ 2014-10-12 19:17     ` Al Viro
  2014-10-13  5:58       ` WANG Chao
  0 siblings, 1 reply; 5+ messages in thread
From: Al Viro @ 2014-10-12 19:17 UTC (permalink / raw)
  To: WANG Chao
  Cc: Sudip Mukherjee, Greg Kroah-Hartman, Masaru Nomura, Peng Tao,
	Chi Pham, Fredrick John Berchmans, David S. Miller,
	open list:STAGING SUBSYSTEM, open list

On Fri, Oct 10, 2014 at 11:21:16AM +0800, WANG Chao wrote:

> I think __user annotation is for no dereferencing in kernel space. In
> this case, I think it's fine to override this error by __force. Because
> they're pointers with identical target types.

Umm...  The real question seems to be whether iovec is the right type in
the first place.  Does ->tx_iov ever contain a vector with _userland_
pointers?  If not, it ought to be struct kvec * instead.

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

* Re: [PATCH resend] staging, lustre: fix a sparse error
  2014-10-12 19:17     ` Al Viro
@ 2014-10-13  5:58       ` WANG Chao
  0 siblings, 0 replies; 5+ messages in thread
From: WANG Chao @ 2014-10-13  5:58 UTC (permalink / raw)
  To: Al Viro
  Cc: Oleg Drokin, Andreas Dilger, Sudip Mukherjee, Greg Kroah-Hartman,
	Masaru Nomura, Peng Tao, Chi Pham, Fredrick John Berchmans,
	David S. Miller, open list:STAGING SUBSYSTEM, open list

On 10/12/14 at 08:17pm, Al Viro wrote:
> On Fri, Oct 10, 2014 at 11:21:16AM +0800, WANG Chao wrote:
> 
> > I think __user annotation is for no dereferencing in kernel space. In
> > this case, I think it's fine to override this error by __force. Because
> > they're pointers with identical target types.
> 
> Umm...  The real question seems to be whether iovec is the right type in
> the first place.  Does ->tx_iov ever contain a vector with _userland_
> pointers?  If not, it ought to be struct kvec * instead.

I'm afraid I'm not familiar with lustre.

[CCing lustre maintainers]

Oleg and Andreas:

Could you answer the Al's question?

For your information, my original post was here:
https://lkml.org/lkml/2014/10/9/135

Thanks
WANG Chao

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

end of thread, other threads:[~2014-10-13  5:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-09 10:25 [PATCH resend] staging, lustre: fix a sparse error WANG Chao
2014-10-09 12:28 ` Sudip Mukherjee
2014-10-10  3:21   ` WANG Chao
2014-10-12 19:17     ` Al Viro
2014-10-13  5:58       ` WANG Chao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).