diff options
author | Linus Torvalds | 2017-07-07 07:06:11 +0200 |
---|---|---|
committer | Linus Torvalds | 2017-07-07 07:06:11 +0200 |
commit | 90880b532a7ebd13a052d6c410807b33809a3efb (patch) | |
tree | cae2ad7874c8d8f29e30a0bea43dd29752a8fba4 /drivers/dio/dio.c | |
parent | Merge branch 'misc.alpha' of git://git.kernel.org/pub/scm/linux/kernel/git/vi... (diff) | |
parent | dio: use probe_kernel_read() (diff) | |
download | kernel-qcow2-linux-90880b532a7ebd13a052d6c410807b33809a3efb.tar.gz kernel-qcow2-linux-90880b532a7ebd13a052d6c410807b33809a3efb.tar.xz kernel-qcow2-linux-90880b532a7ebd13a052d6c410807b33809a3efb.zip |
Merge branch 'work.probe_kernel_read' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull probe_kernel_read() uses from Al Viro:
"Several open-coded probe_kernel_read()..."
* 'work.probe_kernel_read' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
dio: use probe_kernel_read()
hp_sdc: use probe_kernel_read()
hpfb: use probe_kernel_read()
Diffstat (limited to 'drivers/dio/dio.c')
-rw-r--r-- | drivers/dio/dio.c | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/drivers/dio/dio.c b/drivers/dio/dio.c index 830184529109..0d0677f23916 100644 --- a/drivers/dio/dio.c +++ b/drivers/dio/dio.c @@ -116,7 +116,6 @@ int __init dio_find(int deviceid) */ int scode, id; u_char prid, secid, i; - mm_segment_t fs; for (scode = 0; scode < DIO_SCMAX; scode++) { void *va; @@ -135,17 +134,12 @@ int __init dio_find(int deviceid) else va = ioremap(pa, PAGE_SIZE); - fs = get_fs(); - set_fs(KERNEL_DS); - - if (get_user(i, (unsigned char *)va + DIO_IDOFF)) { - set_fs(fs); + if (probe_kernel_read(&i, (unsigned char *)va + DIO_IDOFF, 1)) { if (scode >= DIOII_SCBASE) iounmap(va); continue; /* no board present at that select code */ } - set_fs(fs); prid = DIO_ID(va); if (DIO_NEEDSSECID(prid)) { @@ -170,7 +164,6 @@ int __init dio_find(int deviceid) static int __init dio_init(void) { int scode; - mm_segment_t fs; int i; struct dio_dev *dev; int error; @@ -214,18 +207,12 @@ static int __init dio_init(void) else va = ioremap(pa, PAGE_SIZE); - fs = get_fs(); - set_fs(KERNEL_DS); - - if (get_user(i, (unsigned char *)va + DIO_IDOFF)) { - set_fs(fs); + if (probe_kernel_read(&i, (unsigned char *)va + DIO_IDOFF, 1)) { if (scode >= DIOII_SCBASE) iounmap(va); continue; /* no board present at that select code */ } - set_fs(fs); - /* Found a board, allocate it an entry in the list */ dev = kzalloc(sizeof(struct dio_dev), GFP_KERNEL); if (!dev) |