linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ian Abbott <abbotti@mev.co.uk>
To: Geliang Tang <geliangtang@163.com>
Cc: sudipm.mukherjee@gmail.com, hsweeten@visionengravers.com,
	gregkh@linuxfoundation.org, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] staging: comedi: fix cast warning in comedi_compat32.c
Date: Mon, 22 Jun 2015 17:08:00 +0100	[thread overview]
Message-ID: <558832E0.6000800@mev.co.uk> (raw)
In-Reply-To: <3f8aa13913f8215176c88c0ac731489d4dd3b7d0.1434985928.git.geliangtang@163.com>

On 22/06/15 16:33, Geliang Tang wrote:
> This patch fixes the following sparse warning:
>
> drivers/staging/comedi/comedi_compat32.c:205:16: warning: cast removes
> address space of expression
>
> Signed-off-by: Geliang Tang <geliangtang@163.com>
> ---
> Changes in v3:
>    - fix the 80 character line limit.
>
> Changes in v2:
>    - compat_ptr() is substituted by 'unsigned long'.
> ---
>   drivers/staging/comedi/comedi_compat32.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/comedi/comedi_compat32.c b/drivers/staging/comedi/comedi_compat32.c
> index 2584824..f356386 100644
> --- a/drivers/staging/comedi/comedi_compat32.c
> +++ b/drivers/staging/comedi/comedi_compat32.c
> @@ -202,7 +202,8 @@ static int get_compat_cmd(struct comedi_cmd __user *cmd,
>   	err |= __get_user(temp.uint, &cmd32->stop_arg);
>   	err |= __put_user(temp.uint, &cmd->stop_arg);
>   	err |= __get_user(temp.uptr, &cmd32->chanlist);
> -	err |= __put_user(compat_ptr(temp.uptr), &cmd->chanlist);
> +	err |= __put_user((unsigned int __force *)compat_ptr(temp.uptr),
> +			&cmd->chanlist);
>   	err |= __get_user(temp.uint, &cmd32->chanlist_len);
>   	err |= __put_user(temp.uint, &cmd->chanlist_len);
>   	err |= __get_user(temp.uptr, &cmd32->data);
>

Looks okay now apart from it being ugly, but that can't be helped since 
comedi uses that chanlist member for both user and kernel addresses!

Reviewed-by: Ian Abbott <abbotti@mev.co.uk>

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

      reply	other threads:[~2015-06-22 16:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-20 16:49 [PATCH] staging: comedi: fix sparse warning in comedi_compat32.c Geliang Tang
2015-06-20 10:38 ` Sudip Mukherjee
2015-06-20 14:38   ` Geliang Tang
2015-06-20 14:38     ` [PATCH v2] staging: comedi: fix cast " Geliang Tang
2015-06-22  9:43       ` Ian Abbott
2015-06-22 15:33         ` Geliang Tang
2015-06-22 15:33           ` [PATCH v3] " Geliang Tang
2015-06-22 16:08             ` Ian Abbott [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=558832E0.6000800@mev.co.uk \
    --to=abbotti@mev.co.uk \
    --cc=devel@driverdev.osuosl.org \
    --cc=geliangtang@163.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hsweeten@visionengravers.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sudipm.mukherjee@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).