Skip to contentSkip to conversation

staging, lustre: fix a sparse error

PATCH RESEND In review WANG Chao 3 participants 5 messages Oct 9, 2014 – Oct 13, 2014 Staging

lore
Share & tools
lore

WANG Chao

author
#0 lore raw

PATCH RESEND 1/1 staging, lustre: fix a sparse error

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)

---
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c +1 -1
index 245c9d7..1510594 100644
@@ -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);
 
Signature · 1 line
1.9.3
#1 lore raw
Quoted 15 lines · WANG Chao

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)

---
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c +0 -0
index 245c9d7..1510594 100644

drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c ksocknal_lib_csum_tx(ksock_tx_t *tx) · line 393

Quoted 5 lines
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c +1 -1
@@ -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

Quoted 11 lines
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c +0 -0
 	LASSERT(tx->tx_conn != NULL);
 	LASSERT(tx->tx_conn->ksnc_proto == &ksocknal_protocol_v2x);
 
Signature · 7 lines
1.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
author
#2 lore raw
Quoted 19 lines · Sudip Mukherjee
Quoted 18 lines · WANG Chao

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)

---
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c +0 -0
index 245c9d7..1510594 100644
@@ -390,7 +390,7 @@ ksocknal_lib_csum_tx(ksock_tx_t *tx)
 	__u32	csum;
 	void	*base;
 
Quoted 4 lines

drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c ksocknal_lib_csum_tx(ksock_tx_t *tx) · line 393

Quoted 2 lines
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_lib-linux.c +1 -1
-	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

#3 lore raw
Quoted 3 lines · WANG Chao

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.

author
#4 lore raw
Quoted 9 lines · Al Viro
Quoted 3 lines · WANG Chao

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