From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Sudip Mukherjee <sudipm.mukherjee@gmail.com>, alan@linux.intel.com
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: goldfish_audio.c: sparse warning of incorrect type
Date: Sun, 31 Aug 2014 13:02:41 -0700 [thread overview]
Message-ID: <20140831200241.GA26833@kroah.com> (raw)
In-Reply-To: <1409501782-20775-1-git-send-email-sudipm.mukherjee@gmail.com>
Adding Alan Cox, as he pushed this driver upstream...
On Sun, Aug 31, 2014 at 09:46:22PM +0530, Sudip Mukherjee wrote:
> fixed sparse warning of incorrect type in argument 1 and incorrect type in argument 2
> it was directly dereferencing a __iomem pointer , which will work in x86 but will fail in other architectures.
Please wrap your changelog comments at 72 columns...
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> ---
>
> hi,
> can you please reveiew the patch and check if the approach is correct. If it is correct then I can send another patch to correct the other similar warnings present in this file.
I don't think this is correct, because:
>
> drivers/staging/goldfish/goldfish_audio.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/goldfish/goldfish_audio.c b/drivers/staging/goldfish/goldfish_audio.c
> index c89d0b8..f9a13e7 100644
> --- a/drivers/staging/goldfish/goldfish_audio.c
> +++ b/drivers/staging/goldfish/goldfish_audio.c
> @@ -118,6 +118,7 @@ static ssize_t goldfish_audio_read(struct file *fp, char __user *buf,
> struct goldfish_audio *data = fp->private_data;
> int length;
> int result = 0;
> + void *buffer;
>
> if (!data->read_supported)
> return -ENODEV;
> @@ -133,9 +134,15 @@ static ssize_t goldfish_audio_read(struct file *fp, char __user *buf,
> AUDIO_READ_BUFFER_AVAILABLE);
>
> /* copy data to user space */
> - if (copy_to_user(buf, data->read_buffer, length))
> + buffer = kzalloc(length, GFP_KERNEL);
> + if (buffer == NULL)
> + return -ENOMEM;
> + memcpy_fromio(buffer, data->read_buffer, length);
> + if (copy_to_user((void __user *)buf, buffer, length)) {
> + kfree(buffer);
> return -EFAULT;
> -
> + }
> + kfree(buffer);
The goldfish platform is an "emulator" so iomem is (or should be?) the
same as "normal" memory here. So I think this is a false-positive.
But I could be totally wrong here, Alan?
thanks,
greg k-h
next prev parent reply other threads:[~2014-08-31 20:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-31 16:16 Sudip Mukherjee
2014-08-31 20:02 ` Greg Kroah-Hartman [this message]
2014-09-01 12:39 ` Alan Cox
2014-09-01 9:35 ` Dan Carpenter
2014-09-01 11:49 ` Sudip Mukherjee
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=20140831200241.GA26833@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=alan@linux.intel.com \
--cc=devel@driverdev.osuosl.org \
--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
all inboxes | Powered by JetHome®