From: Alan Cox <alan@linux.intel.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
Peter Senna Tschudin <peter.senna@gmail.com>,
driverdevel <devel@driverdev.osuosl.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jun Tian <jun.j.tian@intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Andreas <schwab@linux-m68k.org>,
Garret Kelly <garret.kelly@gmail.com>,
Octavian Purdila <octavian.purdila@intel.com>,
Nick Kralevich <nnk@google.com>
Subject: Re: [PATCH V4] Fix pointer cast for 32 bits arch
Date: Thu, 16 Apr 2015 18:05:27 +0100 [thread overview]
Message-ID: <1429203927.2878.238.camel@linux.intel.com> (raw)
In-Reply-To: <20150416170144.GM10964@mwanda>
On Thu, 2015-04-16 at 20:01 +0300, Dan Carpenter wrote:
> On Thu, Apr 16, 2015 at 06:14:55PM +0200, Geert Uytterhoeven wrote:
> > On Thu, Apr 16, 2015 at 3:39 PM, Peter Senna Tschudin
> > <peter.senna@gmail.com> wrote:
> > > --- a/drivers/staging/goldfish/goldfish_audio.c
> > > +++ b/drivers/staging/goldfish/goldfish_audio.c
> > > @@ -63,7 +63,7 @@ struct goldfish_audio {
> > > #define AUDIO_READ(data, addr) (readl(data->reg_base + addr))
> > > #define AUDIO_WRITE(data, addr, x) (writel(x, data->reg_base + addr))
> > > #define AUDIO_WRITE64(data, addr, addr2, x) \
> > > - (gf_write64((u64)(x), data->reg_base + addr, data->reg_base+addr2))
> > > + (gf_write_ptr((void *)(x), data->reg_base + addr, data->reg_base+addr2))
> >
> > This one should not be converted, as all callers pass a dma_addr_t, which may
> > be 64-bit on 32-bit systems, i.e. larger than void *.
>
> Ugh... You're right.
>
> I've been avoiding asking this but I can't any longer. What is
> gf_write64() actually doing? We are writing dma addresses, user space
> pointers and kernel space pointers to this hardware?
>
> This stuff doesn't seem to make any kind of sense and I can easily
> imagine a situation where it wrote a 64 bit pointer. Then we partially
> write over it with a 32 bit userspace pointer. Then it writes somewhere
> totally unintended.
>
> This thing doesn't make any sort of sense to me.
Its a 64 on 64 or 32 on 32 virtual machine. Goldfish is used for Android
emulation for all the system level phone emulation tools. On the
emulation side it provides an interface for the emulated OS but makes no
effort to emulate it as if it was a real hardware. If you think of it as
a funky emulator interface all is good. If you think about it as
"hardware" you've got the wrong model and chunks of Goldfish make less
sense.
Alan
next prev parent reply other threads:[~2015-04-16 17:05 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-12 9:26 [PATCH] Fix pointer cast for 32 bits arch Peter Senna Tschudin
2015-04-12 13:05 ` Geert Uytterhoeven
2015-04-12 13:48 ` Peter Senna Tschudin
2015-04-12 15:38 ` Geert Uytterhoeven
2015-04-12 18:14 ` Joe Perches
2015-04-12 19:06 ` Geert Uytterhoeven
2015-04-13 11:14 ` Peter Senna Tschudin
2015-04-13 11:21 ` Geert Uytterhoeven
2015-04-13 11:25 ` Peter Senna Tschudin
2015-04-13 12:31 ` Dan Carpenter
2015-04-16 13:39 ` [PATCH V4] " Peter Senna Tschudin
2015-04-16 16:14 ` Geert Uytterhoeven
2015-04-16 17:01 ` Dan Carpenter
2015-04-16 17:05 ` Alan Cox [this message]
2015-04-16 18:36 ` Peter Senna Tschudin
2015-05-03 18:32 ` Greg Kroah-Hartman
2015-05-04 13:11 ` [PATCH V5] staging: goldfish: Fix pointer cast for 32 bits Peter Senna Tschudin
2015-05-04 13:34 ` Dan Carpenter
2015-05-09 16:24 ` Greg KH
2015-05-19 9:44 ` [PATCH V6] " Peter Senna Tschudin
2015-04-17 8:11 ` [PATCH V4] Fix pointer cast for 32 bits arch Dan Carpenter
2015-04-17 8:20 ` Dan Carpenter
2015-04-17 13:31 ` Alan Cox
2015-04-17 13:59 ` Dan Carpenter
2015-04-17 14:10 ` Alan Cox
2015-04-18 13:34 ` Peter Senna Tschudin
2015-04-18 13:59 ` Dan Carpenter
2015-04-13 9:10 ` [PATCH] " Dan Carpenter
2015-04-13 9:16 ` Peter Senna Tschudin
2015-04-13 9:21 ` Dan Carpenter
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=1429203927.2878.238.camel@linux.intel.com \
--to=alan@linux.intel.com \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=garret.kelly@gmail.com \
--cc=geert@linux-m68k.org \
--cc=gregkh@linuxfoundation.org \
--cc=jun.j.tian@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nnk@google.com \
--cc=octavian.purdila@intel.com \
--cc=peter.senna@gmail.com \
--cc=schwab@linux-m68k.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.