Commit 1b7bb54a authored by Al Viro's avatar Al Viro Committed by Linus Torvalds

[PATCH] m68k: rtc __user annotations

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Cc: Roman Zippel <zippel@linux-m68k.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 2382f77f
...@@ -47,6 +47,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -47,6 +47,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
unsigned char msr; unsigned char msr;
unsigned long flags; unsigned long flags;
struct rtc_time wtime; struct rtc_time wtime;
void __user *argp = (void __user *)arg;
switch (cmd) { switch (cmd) {
case RTC_RD_TIME: /* Read the time/date from RTC */ case RTC_RD_TIME: /* Read the time/date from RTC */
...@@ -69,7 +70,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -69,7 +70,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
} while (wtime.tm_sec != BCD2BIN(rtc->bcd_sec)); } while (wtime.tm_sec != BCD2BIN(rtc->bcd_sec));
rtc->msr = msr; rtc->msr = msr;
local_irq_restore(flags); local_irq_restore(flags);
return copy_to_user((void *)arg, &wtime, sizeof wtime) ? return copy_to_user(argp, &wtime, sizeof wtime) ?
-EFAULT : 0; -EFAULT : 0;
} }
case RTC_SET_TIME: /* Set the RTC */ case RTC_SET_TIME: /* Set the RTC */
...@@ -81,8 +82,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -81,8 +82,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EACCES; return -EACCES;
if (copy_from_user(&rtc_tm, (struct rtc_time*)arg, if (copy_from_user(&rtc_tm, argp, sizeof(struct rtc_time)))
sizeof(struct rtc_time)))
return -EFAULT; return -EFAULT;
yrs = rtc_tm.tm_year; yrs = rtc_tm.tm_year;
......
...@@ -45,6 +45,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -45,6 +45,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
volatile MK48T08ptr_t rtc = (MK48T08ptr_t)MVME_RTC_BASE; volatile MK48T08ptr_t rtc = (MK48T08ptr_t)MVME_RTC_BASE;
unsigned long flags; unsigned long flags;
struct rtc_time wtime; struct rtc_time wtime;
void __user *argp = (void __user *)arg;
switch (cmd) { switch (cmd) {
case RTC_RD_TIME: /* Read the time/date from RTC */ case RTC_RD_TIME: /* Read the time/date from RTC */
...@@ -64,7 +65,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -64,7 +65,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
wtime.tm_wday = BCD2BIN(rtc->bcd_dow)-1; wtime.tm_wday = BCD2BIN(rtc->bcd_dow)-1;
rtc->ctrl = 0; rtc->ctrl = 0;
local_irq_restore(flags); local_irq_restore(flags);
return copy_to_user((void *)arg, &wtime, sizeof wtime) ? return copy_to_user(argp, &wtime, sizeof wtime) ?
-EFAULT : 0; -EFAULT : 0;
} }
case RTC_SET_TIME: /* Set the RTC */ case RTC_SET_TIME: /* Set the RTC */
...@@ -76,8 +77,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -76,8 +77,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EACCES; return -EACCES;
if (copy_from_user(&rtc_tm, (struct rtc_time*)arg, if (copy_from_user(&rtc_tm, argp, sizeof(struct rtc_time)))
sizeof(struct rtc_time)))
return -EFAULT; return -EFAULT;
yrs = rtc_tm.tm_year; yrs = rtc_tm.tm_year;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment