* [PATCH 0/2] fix some sparse warnings in lustre
@ 2014-11-24 18:55 Zahari Doychev
2014-11-24 18:55 ` [PATCH 1/2] [drivers] staging/lustre: fix sparse warnings Zahari Doychev
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Zahari Doychev @ 2014-11-24 18:55 UTC (permalink / raw)
To: linux-kernel; +Cc: devel, oleg.drokin, andreas.dilger, gregkh, bergwolf
The two patches fix several sparse warning in the lustre module.
Zahari Doychev (2):
[drivers] staging/lustre: fix sparse warnings
[drivers] staging/lustre: fix sparse warnings
drivers/staging/lustre/include/linux/lnet/lib-lnet.h | 14 +++++++++-----
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 15 ++++++++++-----
2 files changed, 19 insertions(+), 10 deletions(-)
--
2.1.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] [drivers] staging/lustre: fix sparse warnings
2014-11-24 18:55 [PATCH 0/2] fix some sparse warnings in lustre Zahari Doychev
@ 2014-11-24 18:55 ` Zahari Doychev
2014-11-24 23:40 ` Dan Carpenter
2014-11-24 18:55 ` [PATCH 2/2] " Zahari Doychev
2014-11-26 20:53 ` [PATCH 0/2] fix some sparse warnings in lustre Greg KH
2 siblings, 1 reply; 8+ messages in thread
From: Zahari Doychev @ 2014-11-24 18:55 UTC (permalink / raw)
To: linux-kernel; +Cc: devel, oleg.drokin, andreas.dilger, gregkh, bergwolf
This patch fixes the following sparse warnings:
lib-lnet.h:787:47: warning: incorrect type in initializer (different address spaces)
lib-lnet.h:787:47: expected void [noderef] <asn:1>*iov_base
lib-lnet.h:787:47: got void *dest
Signed-off-by: Zahari Doychev <zahari.doychev@linux.com>
---
drivers/staging/lustre/include/linux/lnet/lib-lnet.h | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
index 7e89b3b..ec70f40 100644
--- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
+++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
@@ -784,7 +784,8 @@ lnet_copy_iov2flat(int dlen, void *dest, unsigned int doffset,
unsigned int nsiov, struct iovec *siov, unsigned int soffset,
unsigned int nob)
{
- struct iovec diov = {/*.iov_base = */ dest, /*.iov_len = */ dlen};
+ struct iovec diov = {/*.iov_base = */ (void __user *)dest,
+ /*.iov_len = */ dlen};
lnet_copy_iov2iov(1, &diov, doffset,
nsiov, siov, soffset, nob);
@@ -795,7 +796,8 @@ lnet_copy_kiov2flat(int dlen, void *dest, unsigned int doffset,
unsigned int nsiov, lnet_kiov_t *skiov,
unsigned int soffset, unsigned int nob)
{
- struct iovec diov = {/* .iov_base = */ dest, /* .iov_len = */ dlen};
+ struct iovec diov = {/* .iov_base = */ (void __user *)dest,
+ /* .iov_len = */ dlen};
lnet_copy_kiov2iov(1, &diov, doffset,
nsiov, skiov, soffset, nob);
@@ -803,9 +805,10 @@ lnet_copy_kiov2flat(int dlen, void *dest, unsigned int doffset,
static inline void
lnet_copy_flat2iov(unsigned int ndiov, struct iovec *diov, unsigned int doffset,
- int slen, void *src, unsigned int soffset, unsigned int nob)
+ int slen, void *src, unsigned int soffset, unsigned int nob)
{
- struct iovec siov = {/*.iov_base = */ src, /*.iov_len = */slen};
+ struct iovec siov = {/*.iov_base = */ (void __user *)src,
+ /*.iov_len = */ slen};
lnet_copy_iov2iov(ndiov, diov, doffset,
1, &siov, soffset, nob);
@@ -816,7 +819,8 @@ lnet_copy_flat2kiov(unsigned int ndiov, lnet_kiov_t *dkiov,
unsigned int doffset, int slen, void *src,
unsigned int soffset, unsigned int nob)
{
- struct iovec siov = {/* .iov_base = */ src, /* .iov_len = */ slen};
+ struct iovec siov = {/* .iov_base = */ (void __user *)src,
+ /* .iov_len = */ slen};
lnet_copy_iov2kiov(ndiov, dkiov, doffset,
1, &siov, soffset, nob);
--
2.1.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] [drivers] staging/lustre: fix sparse warnings
2014-11-24 18:55 [PATCH 0/2] fix some sparse warnings in lustre Zahari Doychev
2014-11-24 18:55 ` [PATCH 1/2] [drivers] staging/lustre: fix sparse warnings Zahari Doychev
@ 2014-11-24 18:55 ` Zahari Doychev
2014-11-26 20:53 ` [PATCH 0/2] fix some sparse warnings in lustre Greg KH
2 siblings, 0 replies; 8+ messages in thread
From: Zahari Doychev @ 2014-11-24 18:55 UTC (permalink / raw)
To: linux-kernel; +Cc: devel, oleg.drokin, andreas.dilger, gregkh, bergwolf
This patch fixes the following warnings:
socklnd_cb.c:134:39: warning: incorrect type in assignment (different address spaces)
socklnd_cb.c:134:39: expected void [noderef] <asn:1>*iov_base
socklnd_cb.c:134:39: got void *<noident>
Signed-off-by: Zahari Doychev <zahari.doychev@linux.com>
---
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
index d29f5f1..971b877 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
@@ -131,7 +131,8 @@ ksocknal_send_iov (ksock_conn_t *conn, ksock_tx_t *tx)
LASSERT (tx->tx_niov > 0);
if (nob < (int) iov->iov_len) {
- iov->iov_base = (void *)((char *)iov->iov_base + nob);
+ iov->iov_base =
+ (void __user *)((char *)iov->iov_base + nob);
iov->iov_len -= nob;
return rc;
}
@@ -1052,7 +1053,8 @@ ksocknal_new_packet (ksock_conn_t *conn, int nob_to_skip)
case KSOCK_PROTO_V3:
conn->ksnc_rx_state = SOCKNAL_RX_KSM_HEADER;
conn->ksnc_rx_iov = (struct iovec *)&conn->ksnc_rx_iov_space;
- conn->ksnc_rx_iov[0].iov_base = (char *)&conn->ksnc_msg;
+ conn->ksnc_rx_iov[0].iov_base =
+ (void __user *)&conn->ksnc_msg;
conn->ksnc_rx_nob_wanted = offsetof(ksock_msg_t, ksm_u);
conn->ksnc_rx_nob_left = offsetof(ksock_msg_t, ksm_u);
@@ -1066,7 +1068,8 @@ ksocknal_new_packet (ksock_conn_t *conn, int nob_to_skip)
conn->ksnc_rx_nob_left = sizeof(lnet_hdr_t);
conn->ksnc_rx_iov = (struct iovec *)&conn->ksnc_rx_iov_space;
- conn->ksnc_rx_iov[0].iov_base = (char *)&conn->ksnc_msg.ksm_u.lnetmsg;
+ conn->ksnc_rx_iov[0].iov_base =
+ (void __user *)&conn->ksnc_msg.ksm_u.lnetmsg;
conn->ksnc_rx_iov[0].iov_len = sizeof (lnet_hdr_t);
break;
@@ -1093,7 +1096,8 @@ ksocknal_new_packet (ksock_conn_t *conn, int nob_to_skip)
do {
nob = MIN (nob_to_skip, sizeof (ksocknal_slop_buffer));
- conn->ksnc_rx_iov[niov].iov_base = ksocknal_slop_buffer;
+ conn->ksnc_rx_iov[niov].iov_base =
+ (void __user *)ksocknal_slop_buffer;
conn->ksnc_rx_iov[niov].iov_len = nob;
niov++;
skipped += nob;
@@ -1218,7 +1222,8 @@ ksocknal_process_receive (ksock_conn_t *conn)
conn->ksnc_rx_nob_left = sizeof(ksock_lnet_msg_t);
conn->ksnc_rx_iov = (struct iovec *)&conn->ksnc_rx_iov_space;
- conn->ksnc_rx_iov[0].iov_base = (char *)&conn->ksnc_msg.ksm_u.lnetmsg;
+ conn->ksnc_rx_iov[0].iov_base =
+ (void __user *)&conn->ksnc_msg.ksm_u.lnetmsg;
conn->ksnc_rx_iov[0].iov_len = sizeof(ksock_lnet_msg_t);
conn->ksnc_rx_niov = 1;
--
2.1.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] [drivers] staging/lustre: fix sparse warnings
2014-11-24 18:55 ` [PATCH 1/2] [drivers] staging/lustre: fix sparse warnings Zahari Doychev
@ 2014-11-24 23:40 ` Dan Carpenter
2014-11-25 0:48 ` Dilger, Andreas
2014-11-25 7:35 ` Zahari Doychev
0 siblings, 2 replies; 8+ messages in thread
From: Dan Carpenter @ 2014-11-24 23:40 UTC (permalink / raw)
To: Zahari Doychev
Cc: linux-kernel, devel, oleg.drokin, bergwolf, andreas.dilger,
gregkh
On Mon, Nov 24, 2014 at 07:55:41PM +0100, Zahari Doychev wrote:
> --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
> +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
> @@ -784,7 +784,8 @@ lnet_copy_iov2flat(int dlen, void *dest, unsigned int doffset,
> unsigned int nsiov, struct iovec *siov, unsigned int soffset,
> unsigned int nob)
> {
> - struct iovec diov = {/*.iov_base = */ dest, /*.iov_len = */ dlen};
> + struct iovec diov = {/*.iov_base = */ (void __user *)dest,
> + /*.iov_len = */ dlen};
>
Why can't we just make the comments into code by removing the /*
characters? Remove the cast by declaring the data as __user data to
begin with instead of declaring it incorrectly and then casting to the
correct type later.
Also it's not allowed to send two patches with the exact same subject.
Also the subject was sucky and too vague anyway. :)
regards,
dan carpenter
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] [drivers] staging/lustre: fix sparse warnings
2014-11-24 23:40 ` Dan Carpenter
@ 2014-11-25 0:48 ` Dilger, Andreas
2014-11-25 7:35 ` Zahari Doychev
1 sibling, 0 replies; 8+ messages in thread
From: Dilger, Andreas @ 2014-11-25 0:48 UTC (permalink / raw)
To: Dan Carpenter
Cc: Zahari Doychev, linux-kernel@vger.kernel.org,
devel@driverdev.osuosl.org, Drokin, Oleg, bergwolf@gmail.com,
gregkh@linuxfoundation.org
The non-posix initializers are a holdover from Windows, where the compiler doesn't have C99 initializers. We don't need that anymore, so the initializer can indeed be uncommented.
Cheers, Andreas
> On Nov 24, 2014, at 16:41, Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
>> On Mon, Nov 24, 2014 at 07:55:41PM +0100, Zahari Doychev wrote:
>> --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
>> +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
>> @@ -784,7 +784,8 @@ lnet_copy_iov2flat(int dlen, void *dest, unsigned int doffset,
>> unsigned int nsiov, struct iovec *siov, unsigned int soffset,
>> unsigned int nob)
>> {
>> - struct iovec diov = {/*.iov_base = */ dest, /*.iov_len = */ dlen};
>> + struct iovec diov = {/*.iov_base = */ (void __user *)dest,
>> + /*.iov_len = */ dlen};
>>
>
> Why can't we just make the comments into code by removing the /*
> characters? Remove the cast by declaring the data as __user data to
> begin with instead of declaring it incorrectly and then casting to the
> correct type later.
>
> Also it's not allowed to send two patches with the exact same subject.
> Also the subject was sucky and too vague anyway. :)
>
> regards,
> dan carpenter
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] [drivers] staging/lustre: fix sparse warnings
2014-11-24 23:40 ` Dan Carpenter
2014-11-25 0:48 ` Dilger, Andreas
@ 2014-11-25 7:35 ` Zahari Doychev
2014-11-25 7:52 ` Dan Carpenter
1 sibling, 1 reply; 8+ messages in thread
From: Zahari Doychev @ 2014-11-25 7:35 UTC (permalink / raw)
To: Dan Carpenter
Cc: linux-kernel, devel, oleg.drokin, bergwolf, andreas.dilger,
gregkh
On Tue, Nov 25, 2014 at 02:40:36AM +0300, Dan Carpenter wrote:
> On Mon, Nov 24, 2014 at 07:55:41PM +0100, Zahari Doychev wrote:
> > --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
> > +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
> > @@ -784,7 +784,8 @@ lnet_copy_iov2flat(int dlen, void *dest, unsigned int doffset,
> > unsigned int nsiov, struct iovec *siov, unsigned int soffset,
> > unsigned int nob)
> > {
> > - struct iovec diov = {/*.iov_base = */ dest, /*.iov_len = */ dlen};
> > + struct iovec diov = {/*.iov_base = */ (void __user *)dest,
> > + /*.iov_len = */ dlen};
> >
>
> Why can't we just make the comments into code by removing the /*
> characters? Remove the cast by declaring the data as __user data to
> begin with instead of declaring it incorrectly and then casting to the
> correct type later.
If I make the declarations right then I am moving the casts to other functions.
I was not sure which one is better but it is not a problem I will fix this.
>
> Also it's not allowed to send two patches with the exact same subject.
> Also the subject was sucky and too vague anyway. :)
Sorry for that.
regards,
Zahari
>
> regards,
> dan carpenter
>
> --
> 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] 8+ messages in thread
* Re: [PATCH 1/2] [drivers] staging/lustre: fix sparse warnings
2014-11-25 7:35 ` Zahari Doychev
@ 2014-11-25 7:52 ` Dan Carpenter
0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2014-11-25 7:52 UTC (permalink / raw)
To: Zahari Doychev
Cc: linux-kernel, devel, oleg.drokin, bergwolf, andreas.dilger,
gregkh
On Tue, Nov 25, 2014 at 08:35:42AM +0100, Zahari Doychev wrote:
> On Tue, Nov 25, 2014 at 02:40:36AM +0300, Dan Carpenter wrote:
> > On Mon, Nov 24, 2014 at 07:55:41PM +0100, Zahari Doychev wrote:
> > > --- a/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
> > > +++ b/drivers/staging/lustre/include/linux/lnet/lib-lnet.h
> > > @@ -784,7 +784,8 @@ lnet_copy_iov2flat(int dlen, void *dest, unsigned int doffset,
> > > unsigned int nsiov, struct iovec *siov, unsigned int soffset,
> > > unsigned int nob)
> > > {
> > > - struct iovec diov = {/*.iov_base = */ dest, /*.iov_len = */ dlen};
> > > + struct iovec diov = {/*.iov_base = */ (void __user *)dest,
> > > + /*.iov_len = */ dlen};
> > >
> >
> > Why can't we just make the comments into code by removing the /*
> > characters? Remove the cast by declaring the data as __user data to
> > begin with instead of declaring it incorrectly and then casting to the
> > correct type later.
>
> If I make the declarations right then I am moving the casts to other functions.
Yeah. It might introduce new warnings. Don't stress about that. Don't
add casts, we'll just fix it all later. It's better to have warnings
instead of hiding them with casts.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/2] fix some sparse warnings in lustre
2014-11-24 18:55 [PATCH 0/2] fix some sparse warnings in lustre Zahari Doychev
2014-11-24 18:55 ` [PATCH 1/2] [drivers] staging/lustre: fix sparse warnings Zahari Doychev
2014-11-24 18:55 ` [PATCH 2/2] " Zahari Doychev
@ 2014-11-26 20:53 ` Greg KH
2 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2014-11-26 20:53 UTC (permalink / raw)
To: Zahari Doychev; +Cc: linux-kernel, devel, oleg.drokin, andreas.dilger, bergwolf
On Mon, Nov 24, 2014 at 07:55:40PM +0100, Zahari Doychev wrote:
> The two patches fix several sparse warning in the lustre module.
>
> Zahari Doychev (2):
> [drivers] staging/lustre: fix sparse warnings
> [drivers] staging/lustre: fix sparse warnings
>
> drivers/staging/lustre/include/linux/lnet/lib-lnet.h | 14 +++++++++-----
> drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 15 ++++++++++-----
> 2 files changed, 19 insertions(+), 10 deletions(-)
Please fix up and resend anything still pending, I've purged your
patches from my queue now as they all seem to not be correct :(
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-11-26 20:53 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-24 18:55 [PATCH 0/2] fix some sparse warnings in lustre Zahari Doychev
2014-11-24 18:55 ` [PATCH 1/2] [drivers] staging/lustre: fix sparse warnings Zahari Doychev
2014-11-24 23:40 ` Dan Carpenter
2014-11-25 0:48 ` Dilger, Andreas
2014-11-25 7:35 ` Zahari Doychev
2014-11-25 7:52 ` Dan Carpenter
2014-11-24 18:55 ` [PATCH 2/2] " Zahari Doychev
2014-11-26 20:53 ` [PATCH 0/2] fix some sparse warnings in lustre Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox