aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/char/zcore.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/char/zcore.c')
-rw-r--r--drivers/s390/char/zcore.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/drivers/s390/char/zcore.c b/drivers/s390/char/zcore.c
index e3b9308b0fe..3b94044027c 100644
--- a/drivers/s390/char/zcore.c
+++ b/drivers/s390/char/zcore.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * For more information please refer to Documentation/s390/zfcpdump.txt 6 * For more information please refer to Documentation/s390/zfcpdump.txt
7 * 7 *
8 * Copyright IBM Corp. 2003, 2008 8 * Copyright IBM Corp. 2003,2008
9 * Author(s): Michael Holzheu 9 * Author(s): Michael Holzheu
10 */ 10 */
11 11
@@ -16,11 +16,11 @@
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <linux/miscdevice.h> 17#include <linux/miscdevice.h>
18#include <linux/debugfs.h> 18#include <linux/debugfs.h>
19#include <linux/module.h>
20#include <asm/asm-offsets.h> 19#include <asm/asm-offsets.h>
21#include <asm/ipl.h> 20#include <asm/ipl.h>
22#include <asm/sclp.h> 21#include <asm/sclp.h>
23#include <asm/setup.h> 22#include <asm/setup.h>
23#include <asm/sigp.h>
24#include <asm/uaccess.h> 24#include <asm/uaccess.h>
25#include <asm/debug.h> 25#include <asm/debug.h>
26#include <asm/processor.h> 26#include <asm/processor.h>
@@ -142,6 +142,22 @@ static int memcpy_hsa_kernel(void *dest, unsigned long src, size_t count)
142 return memcpy_hsa(dest, src, count, TO_KERNEL); 142 return memcpy_hsa(dest, src, count, TO_KERNEL);
143} 143}
144 144
145static int memcpy_real_user(void __user *dest, unsigned long src, size_t count)
146{
147 static char buf[4096];
148 int offs = 0, size;
149
150 while (offs < count) {
151 size = min(sizeof(buf), count - offs);
152 if (memcpy_real(buf, (void *) src + offs, size))
153 return -EFAULT;
154 if (copy_to_user(dest + offs, buf, size))
155 return -EFAULT;
156 offs += size;
157 }
158 return 0;
159}
160
145static int __init init_cpu_info(enum arch_id arch) 161static int __init init_cpu_info(enum arch_id arch)
146{ 162{
147 struct save_area *sa; 163 struct save_area *sa;
@@ -330,8 +346,8 @@ static ssize_t zcore_read(struct file *file, char __user *buf, size_t count,
330 346
331 /* Copy from real mem */ 347 /* Copy from real mem */
332 size = count - mem_offs - hdr_count; 348 size = count - mem_offs - hdr_count;
333 rc = copy_to_user_real(buf + hdr_count + mem_offs, 349 rc = memcpy_real_user(buf + hdr_count + mem_offs, mem_start + mem_offs,
334 (void *) mem_start + mem_offs, size); 350 size);
335 if (rc) 351 if (rc)
336 goto fail; 352 goto fail;
337 353
@@ -640,8 +656,6 @@ static int __init zcore_init(void)
640 656
641 if (ipl_info.type != IPL_TYPE_FCP_DUMP) 657 if (ipl_info.type != IPL_TYPE_FCP_DUMP)
642 return -ENODATA; 658 return -ENODATA;
643 if (OLDMEM_BASE)
644 return -ENODATA;
645 659
646 zcore_dbf = debug_register("zcore", 4, 1, 4 * sizeof(long)); 660 zcore_dbf = debug_register("zcore", 4, 1, 4 * sizeof(long));
647 debug_register_view(zcore_dbf, &debug_sprintf_view); 661 debug_register_view(zcore_dbf, &debug_sprintf_view);