lkml.org 
[lkml]   [2015]   [Apr]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V4] Fix pointer cast for 32 bits arch
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.

regards,
dan carpenter


\
 
 \ /
  Last update: 2015-04-16 19:21    [W:0.342 / U:0.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site