lkml.org 
[lkml]   [2014]   [Jun]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] staging: goldfish: fix direct copy_to_user() from __iomem
From
Date
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




\
 
 \ /
  Last update: 2014-06-23 13:41    [W:0.034 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site