* [PATCH 0/2] Two copy_in_user() declaration fixes
@ 2017-08-23 22:29 Bart Van Assche
2017-08-23 22:29 ` [PATCH 1/2] <linux/uaccess.h>: Fix copy_in_user() declaration Bart Van Assche
2017-08-23 22:29 ` [PATCH 2/2] compat_hdio_ioctl: Fix a declaration Bart Van Assche
0 siblings, 2 replies; 7+ messages in thread
From: Bart Van Assche @ 2017-08-23 22:29 UTC (permalink / raw)
To: Al Viro; +Cc: linux-block, linux-kernel, Bart Van Assche
Hello Al,
When I analyzed the block layer core with sparse I noticed that the declaration
of copy_in_user() and also that of a pointer in compat_hdio_ioctl() are wrong.
Please consider these two patches for kernel v4.14.
Thanks,
Bart.
Bart Van Assche (2):
<linux/uaccess.h>: Fix copy_in_user() declaration
compat_hdio_ioctl: Fix a declaration
block/compat_ioctl.c | 2 +-
include/linux/uaccess.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
--
2.14.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] <linux/uaccess.h>: Fix copy_in_user() declaration
2017-08-23 22:29 [PATCH 0/2] Two copy_in_user() declaration fixes Bart Van Assche
@ 2017-08-23 22:29 ` Bart Van Assche
2017-08-31 21:21 ` Bart Van Assche
2017-08-23 22:29 ` [PATCH 2/2] compat_hdio_ioctl: Fix a declaration Bart Van Assche
1 sibling, 1 reply; 7+ messages in thread
From: Bart Van Assche @ 2017-08-23 22:29 UTC (permalink / raw)
To: Al Viro; +Cc: linux-block, linux-kernel, Bart Van Assche, stable
copy_in_user() copies data from user-space address @from to user-
space address @to. Hence declare both @from and @to as user-space
pointers.
Fixes: commit d597580d3737 ("generic ...copy_..._user primitives")
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: <stable@vger.kernel.org>
---
include/linux/uaccess.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
index acdd6f915a8d..20ef8e6ec2db 100644
--- a/include/linux/uaccess.h
+++ b/include/linux/uaccess.h
@@ -156,7 +156,7 @@ copy_to_user(void __user *to, const void *from, unsigned long n)
}
#ifdef CONFIG_COMPAT
static __always_inline unsigned long __must_check
-copy_in_user(void __user *to, const void *from, unsigned long n)
+copy_in_user(void __user *to, const void __user *from, unsigned long n)
{
might_fault();
if (access_ok(VERIFY_WRITE, to, n) && access_ok(VERIFY_READ, from, n))
--
2.14.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] compat_hdio_ioctl: Fix a declaration
2017-08-23 22:29 [PATCH 0/2] Two copy_in_user() declaration fixes Bart Van Assche
2017-08-23 22:29 ` [PATCH 1/2] <linux/uaccess.h>: Fix copy_in_user() declaration Bart Van Assche
@ 2017-08-23 22:29 ` Bart Van Assche
2017-08-24 14:40 ` Jens Axboe
1 sibling, 1 reply; 7+ messages in thread
From: Bart Van Assche @ 2017-08-23 22:29 UTC (permalink / raw)
To: Al Viro; +Cc: linux-block, linux-kernel, Bart Van Assche, Jens Axboe
This patch avoids that sparse reports the following warning messages:
block/compat_ioctl.c:85:11: warning: incorrect type in assignment (different address spaces)
block/compat_ioctl.c:85:11: expected unsigned long *[noderef] <asn:1>p
block/compat_ioctl.c:85:11: got void [noderef] <asn:1>*
block/compat_ioctl.c:91:21: warning: incorrect type in argument 1 (different address spaces)
block/compat_ioctl.c:91:21: expected void const volatile [noderef] <asn:1>*<noident>
block/compat_ioctl.c:91:21: got unsigned long *[noderef] <asn:1>p
block/compat_ioctl.c:87:53: warning: dereference of noderef expression
block/compat_ioctl.c:91:21: warning: dereference of noderef expression
Fixes: commit d597580d3737 ("generic ...copy_..._user primitives")
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Jens Axboe <axboe@kernel.dk>
---
block/compat_ioctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/compat_ioctl.c b/block/compat_ioctl.c
index 38554c2ea38a..abaf9d78a206 100644
--- a/block/compat_ioctl.c
+++ b/block/compat_ioctl.c
@@ -79,7 +79,7 @@ static int compat_hdio_getgeo(struct gendisk *disk, struct block_device *bdev,
static int compat_hdio_ioctl(struct block_device *bdev, fmode_t mode,
unsigned int cmd, unsigned long arg)
{
- unsigned long *__user p;
+ unsigned long __user *p;
int error;
p = compat_alloc_user_space(sizeof(unsigned long));
--
2.14.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] compat_hdio_ioctl: Fix a declaration
2017-08-23 22:29 ` [PATCH 2/2] compat_hdio_ioctl: Fix a declaration Bart Van Assche
@ 2017-08-24 14:40 ` Jens Axboe
0 siblings, 0 replies; 7+ messages in thread
From: Jens Axboe @ 2017-08-24 14:40 UTC (permalink / raw)
To: Bart Van Assche, Al Viro; +Cc: linux-block, linux-kernel
On 08/23/2017 04:29 PM, Bart Van Assche wrote:
> This patch avoids that sparse reports the following warning messages:
>
> block/compat_ioctl.c:85:11: warning: incorrect type in assignment (different address spaces)
> block/compat_ioctl.c:85:11: expected unsigned long *[noderef] <asn:1>p
> block/compat_ioctl.c:85:11: got void [noderef] <asn:1>*
> block/compat_ioctl.c:91:21: warning: incorrect type in argument 1 (different address spaces)
> block/compat_ioctl.c:91:21: expected void const volatile [noderef] <asn:1>*<noident>
> block/compat_ioctl.c:91:21: got unsigned long *[noderef] <asn:1>p
> block/compat_ioctl.c:87:53: warning: dereference of noderef expression
> block/compat_ioctl.c:91:21: warning: dereference of noderef expression
Applied for 4.14, thanks Bart.
--
Jens Axboe
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] <linux/uaccess.h>: Fix copy_in_user() declaration
2017-08-23 22:29 ` [PATCH 1/2] <linux/uaccess.h>: Fix copy_in_user() declaration Bart Van Assche
@ 2017-08-31 21:21 ` Bart Van Assche
0 siblings, 0 replies; 7+ messages in thread
From: Bart Van Assche @ 2017-08-31 21:21 UTC (permalink / raw)
To: viro; +Cc: linux-kernel, linux-block
T24gV2VkLCAyMDE3LTA4LTIzIGF0IDE1OjI5IC0wNzAwLCBCYXJ0IFZhbiBBc3NjaGUgd3JvdGU6
DQo+IGNvcHlfaW5fdXNlcigpIGNvcGllcyBkYXRhIGZyb20gdXNlci1zcGFjZSBhZGRyZXNzIEBm
cm9tIHRvIHVzZXItDQo+IHNwYWNlIGFkZHJlc3MgQHRvLiBIZW5jZSBkZWNsYXJlIGJvdGggQGZy
b20gYW5kIEB0byBhcyB1c2VyLXNwYWNlDQo+IHBvaW50ZXJzLg0KPiBbIC4uLiBdDQoNCkhpIEFs
LA0KDQpDYW4geW91IGhhdmUgYSBsb29rIGF0IHRoaXMgcGF0Y2g/IFBhdGNoIDIvMiBmcm9tIHRo
aXMgc2VyaWVzIGFscmVhZHkgZ290DQpxdWV1ZWQgZm9yIGtlcm5lbCB2NC4xNCBieSBKZW5zLg0K
DQpUaGFua3MsDQoNCkJhcnQu
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] <linux/uaccess.h>: Fix copy_in_user() declaration
@ 2017-08-31 21:21 ` Bart Van Assche
0 siblings, 0 replies; 7+ messages in thread
From: Bart Van Assche @ 2017-08-31 21:21 UTC (permalink / raw)
To: viro; +Cc: linux-kernel, linux-block
On Wed, 2017-08-23 at 15:29 -0700, Bart Van Assche wrote:
> copy_in_user() copies data from user-space address @from to user-
> space address @to. Hence declare both @from and @to as user-space
> pointers.
> [ ... ]
Hi Al,
Can you have a look at this patch? Patch 2/2 from this series already got
queued for kernel v4.14 by Jens.
Thanks,
Bart.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] <linux/uaccess.h>: Fix copy_in_user() declaration
2017-08-31 21:21 ` Bart Van Assche
(?)
@ 2017-08-31 21:24 ` Al Viro
-1 siblings, 0 replies; 7+ messages in thread
From: Al Viro @ 2017-08-31 21:24 UTC (permalink / raw)
To: Bart Van Assche; +Cc: linux-kernel, linux-block
On Thu, Aug 31, 2017 at 09:21:37PM +0000, Bart Van Assche wrote:
> On Wed, 2017-08-23 at 15:29 -0700, Bart Van Assche wrote:
> > copy_in_user() copies data from user-space address @from to user-
> > space address @to. Hence declare both @from and @to as user-space
> > pointers.
> > [ ... ]
>
> Hi Al,
>
> Can you have a look at this patch? Patch 2/2 from this series already got
> queued for kernel v4.14 by Jens.
Yes, it's in #for-linus in my local tree.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2017-08-31 21:24 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-23 22:29 [PATCH 0/2] Two copy_in_user() declaration fixes Bart Van Assche
2017-08-23 22:29 ` [PATCH 1/2] <linux/uaccess.h>: Fix copy_in_user() declaration Bart Van Assche
2017-08-31 21:21 ` Bart Van Assche
2017-08-31 21:21 ` Bart Van Assche
2017-08-31 21:24 ` Al Viro
2017-08-23 22:29 ` [PATCH 2/2] compat_hdio_ioctl: Fix a declaration Bart Van Assche
2017-08-24 14:40 ` Jens Axboe
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.