Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751334AbbDPRFj (ORCPT ); Thu, 16 Apr 2015 13:05:39 -0400 Received: from mga09.intel.com ([134.134.136.24]:61904 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752120AbbDPRFb (ORCPT ); Thu, 16 Apr 2015 13:05:31 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,589,1422950400"; d="scan'208";a="557214015" Message-ID: <1429203927.2878.238.camel@linux.intel.com> Subject: Re: [PATCH V4] Fix pointer cast for 32 bits arch From: Alan Cox To: Dan Carpenter Cc: Geert Uytterhoeven , Peter Senna Tschudin , driverdevel , Greg Kroah-Hartman , Jun Tian , "linux-kernel@vger.kernel.org" , Andreas , Garret Kelly , Octavian Purdila , Nick Kralevich Date: Thu, 16 Apr 2015 18:05:27 +0100 In-Reply-To: <20150416170144.GM10964@mwanda> References: <20150413122911.GW10964@mwanda> <1429191546-1398-1-git-send-email-peter.senna@gmail.com> <20150416170144.GM10964@mwanda> Organization: Intel Corporation Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.11 (3.12.11-1.fc21) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2105 Lines: 45 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 > > 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/