From 91b1bcf546bae2e633b3c7d0ffb3200f1688cf3e Mon Sep 17 00:00:00 2001 From: Akinobu Mita Date: Tue, 10 Jun 2008 12:50:14 -0700 Subject: [PATCH] --- yaml --- r: 97933 b: refs/heads/master c: ea23ec26727b4df97b4965715f0519b6ddc0aa4b h: refs/heads/master i: 97931: 690cd0c76b0703ee93a3d8f6e138377cebb4c6cf v: v3 --- [refs] | 2 +- trunk/drivers/isdn/hysdn/hysdn_procconf.c | 29 +++++++---------------- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/[refs] b/[refs] index fec97e1dc816..48732706ef57 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 495b36b15e17fb08434e3800959434f06a1a6fbc +refs/heads/master: ea23ec26727b4df97b4965715f0519b6ddc0aa4b diff --git a/trunk/drivers/isdn/hysdn/hysdn_procconf.c b/trunk/drivers/isdn/hysdn/hysdn_procconf.c index 15906d005b05..484299b031f8 100644 --- a/trunk/drivers/isdn/hysdn/hysdn_procconf.c +++ b/trunk/drivers/isdn/hysdn/hysdn_procconf.c @@ -207,30 +207,17 @@ hysdn_conf_write(struct file *file, const char __user *buf, size_t count, loff_t /* read conf file -> output card info data */ /*******************************************/ static ssize_t -hysdn_conf_read(struct file *file, char __user *buf, size_t count, loff_t * off) +hysdn_conf_read(struct file *file, char __user *buf, size_t count, loff_t *off) { char *cp; - int i; - if (file->f_mode & FMODE_READ) { - if (!(cp = file->private_data)) - return (-EFAULT); /* should never happen */ - i = strlen(cp); /* get total string length */ - if (*off < i) { - /* still bytes to transfer */ - cp += *off; /* point to desired data offset */ - i -= *off; /* remaining length */ - if (i > count) - i = count; /* limit length to transfer */ - if (copy_to_user(buf, cp, i)) - return (-EFAULT); /* copy error */ - *off += i; /* adjust offset */ - } else - return (0); - } else - return (-EPERM); /* no permission to read */ - - return (i); + if (!(file->f_mode & FMODE_READ)) + return -EPERM; /* no permission to read */ + + if (!(cp = file->private_data)) + return -EFAULT; /* should never happen */ + + return simple_read_from_buffer(buf, count, off, cp, strlen(cp)); } /* hysdn_conf_read */ /******************/