mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Wim Van Sebroeck <wim@linux-watchdog.org>
Cc: kernel test robot <lkp@intel.com>,
	linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] watchdog: sbc_fitpc2_wdt: add __user annotations
Date: Sun, 25 Oct 2020 10:40:43 -0700	[thread overview]
Message-ID: <d6774374-1024-61ee-78b9-d578d00772be@roeck-us.net> (raw)
In-Reply-To: <20201025124518.31647-1-linux@rasmusvillemoes.dk>

On 10/25/20 5:45 AM, Rasmus Villemoes wrote:
> 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>

It would really be great if we can get rid of all those old drivers.
Can we mark them all as deprecated ?

Reviewed-by: Guenter Roeck <inux@roeck-us.net>

> ---
>  drivers/watchdog/sbc_fitpc2_wdt.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/watchdog/sbc_fitpc2_wdt.c b/drivers/watchdog/sbc_fitpc2_wdt.c
> index 04483d6453d6a147703e..13db71e165836eb73249 100644
> --- a/drivers/watchdog/sbc_fitpc2_wdt.c
> +++ b/drivers/watchdog/sbc_fitpc2_wdt.c
> @@ -78,7 +78,7 @@ static int fitpc2_wdt_open(struct inode *inode, struct file *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 i;
> @@ -125,16 +125,16 @@ static long fitpc2_wdt_ioctl(struct file *file, unsigned int cmd,
>  
>  	switch (cmd) {
>  	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;
>  		break;
>  
>  	case WDIOC_GETSTATUS:
> -		ret = put_user(0, (int *)arg);
> +		ret = put_user(0, (int __user *)arg);
>  		break;
>  
>  	case WDIOC_GETBOOTSTATUS:
> -		ret = put_user(0, (int *)arg);
> +		ret = put_user(0, (int __user *)arg);
>  		break;
>  
>  	case WDIOC_KEEPALIVE:
> @@ -143,7 +143,7 @@ static long fitpc2_wdt_ioctl(struct file *file, unsigned int cmd,
>  		break;
>  
>  	case WDIOC_SETTIMEOUT:
> -		ret = get_user(time, (int *)arg);
> +		ret = get_user(time, (int __user *)arg);
>  		if (ret)
>  			break;
>  
> @@ -157,7 +157,7 @@ static long fitpc2_wdt_ioctl(struct file *file, unsigned int cmd,
>  		fallthrough;
>  
>  	case WDIOC_GETTIMEOUT:
> -		ret = put_user(margin, (int *)arg);
> +		ret = put_user(margin, (int __user *)arg);
>  		break;
>  	}
>  
> 


      reply	other threads:[~2020-10-25 17:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-25 12:45 Rasmus Villemoes
2020-10-25 17:40 ` Guenter Roeck [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d6774374-1024-61ee-78b9-d578d00772be@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=lkp@intel.com \
    --cc=wim@linux-watchdog.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®