Skip to contentSkip to conversation

Question regarding sparse warning in staging/lustre

PATCH Adrian Remonda 2 participants 4 messages Feb 8, 2015 – Feb 9, 2015 Staging

lore
Share & tools
lore
#0 lore raw

Hello,

I'm cleaning the drivers/staging/lustre driver.
I have got the next warning from sparse:

drivers/staging/lustre/lnet/selftest//conctl.c:918:30: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/lustre/lnet/selftest//conctl.c:918:30: expected void [noderef] <asn:1>*to
drivers/staging/lustre/lnet/selftest//conctl.c:918:30: got char *ioc_pbuf2

If I add the __user macro as next:

drivers/staging/lustre/lnet/selftest/conctl.c +1 -1
@@ -46,7 +46,7 @@
 #include "console.h"
 
 static int
-lst_session_new_ioctl(lstio_session_new_args_t *args)
+lst_session_new_ioctl(lstio_session_new_args_t __user *args)
 {
 	char      *name;
 	int	rc;

The warning turns to:

drivers/staging/lustre/lnet/selftest//conctl.c:825:13: warning: dereference of noderef expression

Now the question:
Is this right or it is just a false warning from sparse? Should the __user macro should be also inside the structure fields?

thanks in advance,

Adrian

#1 lore raw
Quoted 23 lines · Adrian Remonda

Hello,

I'm cleaning the drivers/staging/lustre driver.
I have got the next warning from sparse:

drivers/staging/lustre/lnet/selftest//conctl.c:918:30: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/lustre/lnet/selftest//conctl.c:918:30: expected void [noderef] <asn:1>*to
drivers/staging/lustre/lnet/selftest//conctl.c:918:30: got char *ioc_pbuf2

If I add the __user macro as next:

drivers/staging/lustre/lnet/selftest/conctl.c +1 -1
@@ -46,7 +46,7 @@
 #include "console.h"
 
 static int
-lst_session_new_ioctl(lstio_session_new_args_t *args)
+lst_session_new_ioctl(lstio_session_new_args_t __user *args)
 {
 	char      *name;
 	int	rc;
Quoted 7 lines

The warning turns to:

drivers/staging/lustre/lnet/selftest//conctl.c:825:13: warning: dereference of noderef expression

Now the question:
Is this right or it is just a false warning from sparse? Should the __user macro should be also inside the structure fields?

The user/kernel fields in lustre are a total mess, I wouldn't work on them if you don't have to as they need an overhaul in some areas.

So I'd recommend just staying away :)

good luck!

greg k-h

#2 lore raw
Quoted 35 lines · Greg Kroah-Hartman
Quoted 23 lines · Adrian Remonda

Hello,

I'm cleaning the drivers/staging/lustre driver.
I have got the next warning from sparse:

drivers/staging/lustre/lnet/selftest//conctl.c:918:30: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/lustre/lnet/selftest//conctl.c:918:30: expected void [noderef] <asn:1>*to
drivers/staging/lustre/lnet/selftest//conctl.c:918:30: got char *ioc_pbuf2

If I add the __user macro as next:

drivers/staging/lustre/lnet/selftest/conctl.c +1 -1
@@ -46,7 +46,7 @@
 #include "console.h"
 
 static int
-lst_session_new_ioctl(lstio_session_new_args_t *args)
+lst_session_new_ioctl(lstio_session_new_args_t __user *args)
 {
 	char      *name;
 	int	rc;
Quoted 7 lines

The warning turns to:

drivers/staging/lustre/lnet/selftest//conctl.c:825:13: warning: dereference of noderef expression

Now the question:
Is this right or it is just a false warning from sparse? Should the __user macro should be also inside the structure fields?

The user/kernel fields in lustre are a total mess, I wouldn't work on them if you don't have to as they need an overhaul in some areas.

Quoted 5 lines

So I'd recommend just staying away :)

good luck!

greg k-h

Ok. I had already done some modifications anyway. I sent you the patch of the few I did

Regards,
Adrian

#3 lore raw
Quoted 36 lines · AdrianRemonda
Quoted 35 lines · Greg Kroah-Hartman
Quoted 23 lines · Adrian Remonda

Hello,

I'm cleaning the drivers/staging/lustre driver.
I have got the next warning from sparse:

drivers/staging/lustre/lnet/selftest//conctl.c:918:30: warning: incorrect type in argument 1 (different address spaces)
drivers/staging/lustre/lnet/selftest//conctl.c:918:30: expected void [noderef] <asn:1>*to
drivers/staging/lustre/lnet/selftest//conctl.c:918:30: got char *ioc_pbuf2

If I add the __user macro as next:

drivers/staging/lustre/lnet/selftest/conctl.c +1 -1
@@ -46,7 +46,7 @@
 #include "console.h"
 
 static int
-lst_session_new_ioctl(lstio_session_new_args_t *args)
+lst_session_new_ioctl(lstio_session_new_args_t __user *args)
 {
 	char      *name;
 	int	rc;
Quoted 7 lines

The warning turns to:

drivers/staging/lustre/lnet/selftest//conctl.c:825:13: warning: dereference of noderef expression

Now the question:
Is this right or it is just a false warning from sparse? Should the __user macro should be also inside the structure fields?

The user/kernel fields in lustre are a total mess, I wouldn't work on them if you don't have to as they need an overhaul in some areas.

Quoted 8 lines
Quoted 5 lines

So I'd recommend just staying away :)

good luck!

greg k-h

Ok. I had already done some modifications anyway. I sent you the patch of the few I did

I can't take those as I don't think they are correct, so I'll just drop them, sorry.

greg k-h