aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/cris/kernel/profile.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/arch/cris/kernel/profile.c b/arch/cris/kernel/profile.c
index 44f7b4f79476..9aa571169bcc 100644
--- a/arch/cris/kernel/profile.c
+++ b/arch/cris/kernel/profile.c
@@ -35,19 +35,16 @@ read_cris_profile(struct file *file, char __user *buf,
35 size_t count, loff_t *ppos) 35 size_t count, loff_t *ppos)
36{ 36{
37 unsigned long p = *ppos; 37 unsigned long p = *ppos;
38 ssize_t ret;
38 39
39 if (p > SAMPLE_BUFFER_SIZE) 40 ret = simple_read_from_buffer(buf, count, ppos, sample_buffer,
40 return 0; 41 SAMPLE_BUFFER_SIZE);
42 if (ret < 0)
43 return ret;
41 44
42 if (p + count > SAMPLE_BUFFER_SIZE) 45 memset(sample_buffer + p, 0, ret);
43 count = SAMPLE_BUFFER_SIZE - p;
44 if (copy_to_user(buf, sample_buffer + p,count))
45 return -EFAULT;
46 46
47 memset(sample_buffer + p, 0, count); 47 return ret;
48 *ppos += count;
49
50 return count;
51} 48}
52 49
53static ssize_t 50static ssize_t