public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: lustre: Fix the warning messages about casting without __user macro
@ 2014-12-10  6:56 Shalin Mehta
  2014-12-10  7:09 ` Al Viro
  0 siblings, 1 reply; 4+ messages in thread
From: Shalin Mehta @ 2014-12-10  6:56 UTC (permalink / raw)
  To: andreas.dilger
  Cc: gregkh, bergwolf, gdonald, peterz, tranmanphong, massa.nomura,
	HPDD-discuss, devel, linux-kernel, majordomo, Shalin Mehta

From: Shalin Mehta <shalinmehta85@gmail.com>

This issue is showed up while compiling with sparse. The iov_base in struct iovec struct explicitly declares that the assigned value should be user space pointer with __user macro. Where as here, the __user macro isn't used while casting.

Signed-off-by: Shalin Mehta <shalinmehta85@gmail.com>
---
 drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c | 10 +++++-----
 1 file changed, 5 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..c40b7e0 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
@@ -131,7 +131,7 @@ 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 __user *)iov->iov_base + nob);
 			iov->iov_len -= nob;
 			return rc;
 		}
@@ -1052,7 +1052,7 @@ 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 = (char __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 +1066,7 @@ 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 = (char __user *)&conn->ksnc_msg.ksm_u.lnetmsg;
 			conn->ksnc_rx_iov[0].iov_len  = sizeof (lnet_hdr_t);
 			break;
 
@@ -1093,7 +1093,7 @@ 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 +1218,7 @@ 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 = (char __user *)&conn->ksnc_msg.ksm_u.lnetmsg;
 		conn->ksnc_rx_iov[0].iov_len  = sizeof(ksock_lnet_msg_t);
 
 		conn->ksnc_rx_niov = 1;
-- 
1.9.1


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

* Re: [PATCH] staging: lustre: Fix the warning messages about casting without __user macro
  2014-12-10  6:56 [PATCH] staging: lustre: Fix the warning messages about casting without __user macro Shalin Mehta
@ 2014-12-10  7:09 ` Al Viro
  2014-12-10 14:49   ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Al Viro @ 2014-12-10  7:09 UTC (permalink / raw)
  To: Shalin Mehta
  Cc: andreas.dilger, gregkh, bergwolf, gdonald, peterz, tranmanphong,
	massa.nomura, HPDD-discuss, devel, linux-kernel, majordomo

On Tue, Dec 09, 2014 at 10:56:12PM -0800, Shalin Mehta wrote:
> From: Shalin Mehta <shalinmehta85@gmail.com>
> 
> This issue is showed up while compiling with sparse. The iov_base in struct iovec struct explicitly declares that the assigned value should be user space pointer with __user macro. Where as here, the __user macro isn't used while casting.

... and pointers are not user space ones at all.  Which is to say, quit
messing with casts; it's not struct iovec.  Proper fix is to replace
it here (and in almost all places throughout drivers/staging/lustre) with
struct kvec.  And yes, such a patch had been sent.  Still not applied,
AFAICS...

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

* Re: [PATCH] staging: lustre: Fix the warning messages about casting without __user macro
  2014-12-10  7:09 ` Al Viro
@ 2014-12-10 14:49   ` Greg KH
  2015-01-09 19:38     ` Andrey Utkin
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2014-12-10 14:49 UTC (permalink / raw)
  To: Al Viro
  Cc: Shalin Mehta, devel, andreas.dilger, gdonald, peterz, bergwolf,
	linux-kernel, majordomo, tranmanphong, HPDD-discuss, massa.nomura

On Wed, Dec 10, 2014 at 07:09:59AM +0000, Al Viro wrote:
> On Tue, Dec 09, 2014 at 10:56:12PM -0800, Shalin Mehta wrote:
> > From: Shalin Mehta <shalinmehta85@gmail.com>
> > 
> > This issue is showed up while compiling with sparse. The iov_base in struct iovec struct explicitly declares that the assigned value should be user space pointer with __user macro. Where as here, the __user macro isn't used while casting.
> 
> ... and pointers are not user space ones at all.  Which is to say, quit
> messing with casts; it's not struct iovec.  Proper fix is to replace
> it here (and in almost all places throughout drivers/staging/lustre) with
> struct kvec.  And yes, such a patch had been sent.  Still not applied,
> AFAICS...

Yeah, it's in the merge window and I'll pick new staging patches back up
when 3.19-rc1 is released.

thanks,

greg k-h

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

* Re: [PATCH] staging: lustre: Fix the warning messages about casting without __user macro
  2014-12-10 14:49   ` Greg KH
@ 2015-01-09 19:38     ` Andrey Utkin
  0 siblings, 0 replies; 4+ messages in thread
From: Andrey Utkin @ 2015-01-09 19:38 UTC (permalink / raw)
  To: Greg KH
  Cc: Al Viro, OSUOSL Drivers, bergwolf, Dilger, Andreas, peterz,
	Shalin Mehta, linux-kernel@vger.kernel.org, majordomo, gdonald,
	tranmanphong, HPDD-discuss@ml01.01.org, massa.nomura

2014-12-10 16:49 GMT+02:00 Greg KH <gregkh@linuxfoundation.org>:
> On Wed, Dec 10, 2014 at 07:09:59AM +0000, Al Viro wrote:
>> On Tue, Dec 09, 2014 at 10:56:12PM -0800, Shalin Mehta wrote:
>> > From: Shalin Mehta <shalinmehta85@gmail.com>
>> >
>> > This issue is showed up while compiling with sparse. The iov_base in struct iovec struct explicitly declares that the assigned value should be user space pointer with __user macro. Where as here, the __user macro isn't used while casting.
>>
>> ... and pointers are not user space ones at all.  Which is to say, quit
>> messing with casts; it's not struct iovec.  Proper fix is to replace
>> it here (and in almost all places throughout drivers/staging/lustre) with
>> struct kvec.  And yes, such a patch had been sent.  Still not applied,
>> AFAICS...
>
> Yeah, it's in the merge window and I'll pick new staging patches back up
> when 3.19-rc1 is released.

Hi Greg,
Still no commits for
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c since Sun Nov
23 (staging: lustre: Coalesce string fragments) in linux-next. Maybe
the aforementioned commit got missed for merging?

-- 
Andrey Utkin

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

end of thread, other threads:[~2015-01-09 19:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-10  6:56 [PATCH] staging: lustre: Fix the warning messages about casting without __user macro Shalin Mehta
2014-12-10  7:09 ` Al Viro
2014-12-10 14:49   ` Greg KH
2015-01-09 19:38     ` Andrey Utkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox