aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/mon
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/mon')
-rw-r--r--drivers/usb/mon/mon_stat.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/drivers/usb/mon/mon_stat.c b/drivers/usb/mon/mon_stat.c
index c7a595cd648a..ac8b0d5ce7f8 100644
--- a/drivers/usb/mon/mon_stat.c
+++ b/drivers/usb/mon/mon_stat.c
@@ -9,6 +9,7 @@
9 9
10#include <linux/kernel.h> 10#include <linux/kernel.h>
11#include <linux/usb.h> 11#include <linux/usb.h>
12#include <linux/fs.h>
12#include <asm/uaccess.h> 13#include <asm/uaccess.h>
13 14
14#include "usb_mon.h" 15#include "usb_mon.h"
@@ -42,19 +43,8 @@ static ssize_t mon_stat_read(struct file *file, char __user *buf,
42 size_t nbytes, loff_t *ppos) 43 size_t nbytes, loff_t *ppos)
43{ 44{
44 struct snap *sp = file->private_data; 45 struct snap *sp = file->private_data;
45 loff_t pos = *ppos;
46 int cnt;
47 46
48 if (pos < 0 || pos >= sp->slen) 47 return simple_read_from_buffer(buf, nbytes, ppos, sp->str, sp->slen);
49 return 0;
50 if (nbytes == 0)
51 return 0;
52 if ((cnt = sp->slen - pos) > nbytes)
53 cnt = nbytes;
54 if (copy_to_user(buf, sp->str + pos, cnt))
55 return -EFAULT;
56 *ppos = pos + cnt;
57 return cnt;
58} 48}
59 49
60static int mon_stat_release(struct inode *inode, struct file *file) 50static int mon_stat_release(struct inode *inode, struct file *file)