diff options
Diffstat (limited to 'drivers/zorro/proc.c')
-rw-r--r-- | drivers/zorro/proc.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/zorro/proc.c b/drivers/zorro/proc.c index 3c7046d79654..cafc50454292 100644 --- a/drivers/zorro/proc.c +++ b/drivers/zorro/proc.c | |||
@@ -22,8 +22,9 @@ static loff_t | |||
22 | proc_bus_zorro_lseek(struct file *file, loff_t off, int whence) | 22 | proc_bus_zorro_lseek(struct file *file, loff_t off, int whence) |
23 | { | 23 | { |
24 | loff_t new = -1; | 24 | loff_t new = -1; |
25 | struct inode *inode = file->f_path.dentry->d_inode; | ||
25 | 26 | ||
26 | lock_kernel(); | 27 | mutex_lock(&inode->i_mutex); |
27 | switch (whence) { | 28 | switch (whence) { |
28 | case 0: | 29 | case 0: |
29 | new = off; | 30 | new = off; |
@@ -35,12 +36,12 @@ proc_bus_zorro_lseek(struct file *file, loff_t off, int whence) | |||
35 | new = sizeof(struct ConfigDev) + off; | 36 | new = sizeof(struct ConfigDev) + off; |
36 | break; | 37 | break; |
37 | } | 38 | } |
38 | if (new < 0 || new > sizeof(struct ConfigDev)) { | 39 | if (new < 0 || new > sizeof(struct ConfigDev)) |
39 | unlock_kernel(); | 40 | new = -EINVAL; |
40 | return -EINVAL; | 41 | else |
41 | } | 42 | file->f_pos = new; |
42 | unlock_kernel(); | 43 | mutex_unlock(&inode->i_mutex); |
43 | return (file->f_pos = new); | 44 | return new; |
44 | } | 45 | } |
45 | 46 | ||
46 | static ssize_t | 47 | static ssize_t |
@@ -67,7 +68,7 @@ proc_bus_zorro_read(struct file *file, char __user *buf, size_t nbytes, loff_t * | |||
67 | cd.cd_BoardAddr = (void *)zorro_resource_start(z); | 68 | cd.cd_BoardAddr = (void *)zorro_resource_start(z); |
68 | cd.cd_BoardSize = zorro_resource_len(z); | 69 | cd.cd_BoardSize = zorro_resource_len(z); |
69 | 70 | ||
70 | if (copy_to_user(buf, &cd, nbytes)) | 71 | if (copy_to_user(buf, (void *)&cd + pos, nbytes)) |
71 | return -EFAULT; | 72 | return -EFAULT; |
72 | *ppos += nbytes; | 73 | *ppos += nbytes; |
73 | 74 | ||