mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 20:51:03 +02:00
watchdog: sbc_fitpc2_wdt: add __user annotations
After a change to the put_user() macro on x86, kernel test robot has started sending me complaints (from sparse) about passing kernel pointers to put_user(). So add the __user annotations to the various casts in fitpc2_wdt_ioctl(), and while in here, also make the write method actually match the prototype of file_operations::write. Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Reviewed-by: Guenter Roeck <inux@roeck-us.net> Link: https://lore.kernel.org/r/20201025124518.31647-1-linux@rasmusvillemoes.dk Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
This commit is contained in:
committed by
Wim Van Sebroeck
parent
9747f12b5b
commit
347755d2a8
@@ -78,7 +78,7 @@ static int fitpc2_wdt_open(struct inode *inode, struct file *file)
|
|||||||
return stream_open(inode, file);
|
return stream_open(inode, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t fitpc2_wdt_write(struct file *file, const char *data,
|
static ssize_t fitpc2_wdt_write(struct file *file, const char __user *data,
|
||||||
size_t len, loff_t *ppos)
|
size_t len, loff_t *ppos)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
@@ -125,16 +125,16 @@ static long fitpc2_wdt_ioctl(struct file *file, unsigned int cmd,
|
|||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case WDIOC_GETSUPPORT:
|
case WDIOC_GETSUPPORT:
|
||||||
ret = copy_to_user((struct watchdog_info *)arg, &ident,
|
ret = copy_to_user((struct watchdog_info __user *)arg, &ident,
|
||||||
sizeof(ident)) ? -EFAULT : 0;
|
sizeof(ident)) ? -EFAULT : 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WDIOC_GETSTATUS:
|
case WDIOC_GETSTATUS:
|
||||||
ret = put_user(0, (int *)arg);
|
ret = put_user(0, (int __user *)arg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WDIOC_GETBOOTSTATUS:
|
case WDIOC_GETBOOTSTATUS:
|
||||||
ret = put_user(0, (int *)arg);
|
ret = put_user(0, (int __user *)arg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WDIOC_KEEPALIVE:
|
case WDIOC_KEEPALIVE:
|
||||||
@@ -143,7 +143,7 @@ static long fitpc2_wdt_ioctl(struct file *file, unsigned int cmd,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WDIOC_SETTIMEOUT:
|
case WDIOC_SETTIMEOUT:
|
||||||
ret = get_user(time, (int *)arg);
|
ret = get_user(time, (int __user *)arg);
|
||||||
if (ret)
|
if (ret)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -157,7 +157,7 @@ static long fitpc2_wdt_ioctl(struct file *file, unsigned int cmd,
|
|||||||
fallthrough;
|
fallthrough;
|
||||||
|
|
||||||
case WDIOC_GETTIMEOUT:
|
case WDIOC_GETTIMEOUT:
|
||||||
ret = put_user(margin, (int *)arg);
|
ret = put_user(margin, (int __user *)arg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user