Re: [PATCH resend] staging, lustre: fix a sparse error

From: WANG Chao
Date: Thu Oct 09 2014 - 23:21:33 EST


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@xxxxxxxxx>
> > ---
> > 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/