staging, lustre: fix a sparse error
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
@@ -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
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)Signed-off-by WANG Chao <[email protected]>--- 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
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
-0LASSERT (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/
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)Signed-off-by WANG Chao <[email protected]>--- 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@@ -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_baseis 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
Quoted 3 lines · WANG Chao
I think
__userannotation 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.
Quoted 9 lines · Al Viro
Quoted 3 lines · WANG Chao
I think
__userannotation 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