mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alan Cox <alan@linux.intel.com>
To: James A Shackleford <shack@linux.com>
Cc: gregkh@linuxfoundation.org, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: goldfish: fix direct copy_to_user() from __iomem
Date: Mon, 23 Jun 2014 11:58:48 +0100	[thread overview]
Message-ID: <1403521128.27368.2.camel@acox1-desk.ger.corp.intel.com> (raw)
In-Reply-To: <1403422178-20833-1-git-send-email-shack@linux.com>

On Sun, 2014-06-22 at 03:29 -0400, James A Shackleford wrote:
> This patch allocates a few pages and performs an ioread8_rep() from the bus
> address, which are then copied to userspace.  This fixes the sparse warning:
> 
> drivers/staging/goldfish/goldfish_audio.c:136:43: warning: incorrect type in argument 2 (different address spaces)
> drivers/staging/goldfish/goldfish_audio.c:136:43:    expected void const *from
> drivers/staging/goldfish/goldfish_audio.c:136:43:    got char [noderef] <asn:2>*read_buffer
> 
> which was a result of performing a copy_to_user() directly from the bus address
> to the userspace, which can be unsafe across some architectures.

Goldfish is a specific architecture. It shouldn't be doing direct
xcopies like that - which is why the code is in staging but at the same
time allocating a buffer each call and doing extra copies is not the
right answer.

It should be mapping the pages when they are first set up.

Alan



      reply	other threads:[~2014-06-23 10:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-22  7:29 James A Shackleford
2014-06-23 10:58 ` Alan Cox [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=1403521128.27368.2.camel@acox1-desk.ger.corp.intel.com \
    --to=alan@linux.intel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shack@linux.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®