All of lore.kernel.org
 help / color / mirror / Atom feed
From: "tiejun.chen" <tiejun.chen@windriver.com>
To: <benh@kernel.crashing.org>, <galak@kernel.crashing.org>
Cc: <linuxppc-dev@ozlabs.org>, <linux-watchdog@vger.kernel.org>
Subject: Re: [PATCH 1/1] booke/wdt: fix incorrect WDIOC_GETSUPPORT return path
Date: Mon, 6 Aug 2012 11:10:58 +0800	[thread overview]
Message-ID: <501F35C2.6090005@windriver.com> (raw)
In-Reply-To: <1343636122-23273-1-git-send-email-tiejun.chen@windriver.com>

On 07/30/2012 04:15 PM, Tiejun Chen wrote:
> We miss that correct WDIOC_GETSUPPORT return path when perform
> copy_to_user() properly.

Any comments?

Thanks
Tiejun

> 
> Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
> ---
>  drivers/watchdog/booke_wdt.c |    7 ++++---
>  1 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/watchdog/booke_wdt.c b/drivers/watchdog/booke_wdt.c
> index 3fe82d0..2be7f29 100644
> --- a/drivers/watchdog/booke_wdt.c
> +++ b/drivers/watchdog/booke_wdt.c
> @@ -162,12 +162,13 @@ static long booke_wdt_ioctl(struct file *file,
>  				unsigned int cmd, unsigned long arg)
>  {
>  	u32 tmp = 0;
> -	u32 __user *p = (u32 __user *)arg;
> +	void __user *argp = (u32 __user *)arg;
> +	u32 __user *p = argp;
>  
>  	switch (cmd) {
>  	case WDIOC_GETSUPPORT:
> -		if (copy_to_user((void *)arg, &ident, sizeof(ident)))
> -			return -EFAULT;
> +		return copy_to_user(argp, &ident,
> +				sizeof(ident)) ? -EFAULT : 0;
>  	case WDIOC_GETSTATUS:
>  		return put_user(0, p);
>  	case WDIOC_GETBOOTSTATUS:
> 


WARNING: multiple messages have this Message-ID (diff)
From: "tiejun.chen" <tiejun.chen@windriver.com>
To: <benh@kernel.crashing.org>, <galak@kernel.crashing.org>
Cc: linuxppc-dev@ozlabs.org, linux-watchdog@vger.kernel.org
Subject: Re: [PATCH 1/1] booke/wdt: fix incorrect WDIOC_GETSUPPORT return path
Date: Mon, 6 Aug 2012 11:10:58 +0800	[thread overview]
Message-ID: <501F35C2.6090005@windriver.com> (raw)
In-Reply-To: <1343636122-23273-1-git-send-email-tiejun.chen@windriver.com>

On 07/30/2012 04:15 PM, Tiejun Chen wrote:
> We miss that correct WDIOC_GETSUPPORT return path when perform
> copy_to_user() properly.

Any comments?

Thanks
Tiejun

> 
> Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com>
> ---
>  drivers/watchdog/booke_wdt.c |    7 ++++---
>  1 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/watchdog/booke_wdt.c b/drivers/watchdog/booke_wdt.c
> index 3fe82d0..2be7f29 100644
> --- a/drivers/watchdog/booke_wdt.c
> +++ b/drivers/watchdog/booke_wdt.c
> @@ -162,12 +162,13 @@ static long booke_wdt_ioctl(struct file *file,
>  				unsigned int cmd, unsigned long arg)
>  {
>  	u32 tmp = 0;
> -	u32 __user *p = (u32 __user *)arg;
> +	void __user *argp = (u32 __user *)arg;
> +	u32 __user *p = argp;
>  
>  	switch (cmd) {
>  	case WDIOC_GETSUPPORT:
> -		if (copy_to_user((void *)arg, &ident, sizeof(ident)))
> -			return -EFAULT;
> +		return copy_to_user(argp, &ident,
> +				sizeof(ident)) ? -EFAULT : 0;
>  	case WDIOC_GETSTATUS:
>  		return put_user(0, p);
>  	case WDIOC_GETBOOTSTATUS:
> 

  reply	other threads:[~2012-08-06  3:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-30  8:15 [PATCH 1/1] booke/wdt: fix incorrect WDIOC_GETSUPPORT return path Tiejun Chen
2012-07-30  8:15 ` Tiejun Chen
2012-08-06  3:10 ` tiejun.chen [this message]
2012-08-06  3:10   ` tiejun.chen
2012-08-06 16:13   ` Kumar Gala
2012-08-06 16:13     ` Kumar Gala
2012-08-06 23:27 ` Tabi Timur-B04825
2012-08-06 23:27   ` Tabi Timur-B04825
2012-08-06 23:36   ` Tabi Timur-B04825
2012-08-06 23:36     ` Tabi Timur-B04825
2012-08-07  1:56     ` tiejun.chen
2012-08-07  1:56       ` tiejun.chen

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=501F35C2.6090005@windriver.com \
    --to=tiejun.chen@windriver.com \
    --cc=benh@kernel.crashing.org \
    --cc=galak@kernel.crashing.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.