aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/watchdog/sbc_epx_c3.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/char/watchdog/sbc_epx_c3.c b/drivers/char/watchdog/sbc_epx_c3.c
index 7a4dfb95d087..837b1ec3ffe3 100644
--- a/drivers/char/watchdog/sbc_epx_c3.c
+++ b/drivers/char/watchdog/sbc_epx_c3.c
@@ -92,7 +92,7 @@ static int epx_c3_release(struct inode *inode, struct file *file)
92 return 0; 92 return 0;
93} 93}
94 94
95static ssize_t epx_c3_write(struct file *file, const char *data, 95static ssize_t epx_c3_write(struct file *file, const char __user *data,
96 size_t len, loff_t *ppos) 96 size_t len, loff_t *ppos)
97{ 97{
98 /* Refresh the timer. */ 98 /* Refresh the timer. */
@@ -105,6 +105,7 @@ static int epx_c3_ioctl(struct inode *inode, struct file *file,
105 unsigned int cmd, unsigned long arg) 105 unsigned int cmd, unsigned long arg)
106{ 106{
107 int options, retval = -EINVAL; 107 int options, retval = -EINVAL;
108 int __user *argp = (void __user *)arg;
108 static struct watchdog_info ident = { 109 static struct watchdog_info ident = {
109 .options = WDIOF_KEEPALIVEPING | 110 .options = WDIOF_KEEPALIVEPING |
110 WDIOF_MAGICCLOSE, 111 WDIOF_MAGICCLOSE,
@@ -114,20 +115,19 @@ static int epx_c3_ioctl(struct inode *inode, struct file *file,
114 115
115 switch (cmd) { 116 switch (cmd) {
116 case WDIOC_GETSUPPORT: 117 case WDIOC_GETSUPPORT:
117 if (copy_to_user((struct watchdog_info *)arg, 118 if (copy_to_user(argp, &ident, sizeof(ident)))
118 &ident, sizeof(ident)))
119 return -EFAULT; 119 return -EFAULT;
120 return 0; 120 return 0;
121 case WDIOC_GETSTATUS: 121 case WDIOC_GETSTATUS:
122 case WDIOC_GETBOOTSTATUS: 122 case WDIOC_GETBOOTSTATUS:
123 return put_user(0,(int *)arg); 123 return put_user(0, argp);
124 case WDIOC_KEEPALIVE: 124 case WDIOC_KEEPALIVE:
125 epx_c3_pet(); 125 epx_c3_pet();
126 return 0; 126 return 0;
127 case WDIOC_GETTIMEOUT: 127 case WDIOC_GETTIMEOUT:
128 return put_user(WATCHDOG_TIMEOUT,(int *)arg); 128 return put_user(WATCHDOG_TIMEOUT, argp);
129 case WDIOC_SETOPTIONS: { 129 case WDIOC_SETOPTIONS:
130 if (get_user(options, (int *)arg)) 130 if (get_user(options, argp))
131 return -EFAULT; 131 return -EFAULT;
132 132
133 if (options & WDIOS_DISABLECARD) { 133 if (options & WDIOS_DISABLECARD) {
@@ -141,7 +141,6 @@ static int epx_c3_ioctl(struct inode *inode, struct file *file,
141 } 141 }
142 142
143 return retval; 143 return retval;
144 }
145 default: 144 default:
146 return -ENOIOCTLCMD; 145 return -ENOIOCTLCMD;
147 } 146 }