From mboxrd@z Thu Jan 1 00:00:00 1970 From: Markus Armbruster Subject: Re: [PATCH 4/4] kvm: i386: Add classic PCI device assignment Date: Wed, 29 Aug 2012 10:27:04 +0200 Message-ID: <878vcyrtlz.fsf@blackfin.pond.sub.org> References: <825e653c9cfe9d8e26185917cbe1f1dd7ae299e2.1346048917.git.jan.kiszka@web.de> <503C74DD.3020307@msgid.tls.msk.ru> <20120828172838.GD3661@redhat.com> <87fw76ak5l.fsf@codemonkey.ws> Mime-Version: 1.0 Content-Type: text/plain Cc: kvm@vger.kernel.org, "Michael S. Tsirkin" , Marcelo Tosatti , Michael Tokarev , qemu-devel@nongnu.org, Blue Swirl , Alex Williamson , Jan Kiszka , Avi Kivity To: Anthony Liguori Return-path: In-Reply-To: <87fw76ak5l.fsf@codemonkey.ws> (Anthony Liguori's message of "Tue, 28 Aug 2012 14:31:02 -0500") List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org Sender: qemu-devel-bounces+gceq-qemu-devel=gmane.org@nongnu.org List-Id: kvm.vger.kernel.org Anthony Liguori writes: > Blue Swirl writes: > >> On Tue, Aug 28, 2012 at 5:28 PM, Michael S. Tsirkin wrote: >>> On Tue, Aug 28, 2012 at 05:01:55PM +0000, Blue Swirl wrote: >>>> On Tue, Aug 28, 2012 at 7:35 AM, Michael Tokarev wrote: >>>> > On 27.08.2012 22:56, Blue Swirl wrote: >>>> > [] >>>> >>> +static uint32_t slow_bar_readb(void *opaque, target_phys_addr_t addr) >>>> >>> +{ >>>> >>> + AssignedDevRegion *d = opaque; >>>> >>> + uint8_t *in = d->u.r_virtbase + addr; >>>> >> >>>> >> Don't perform arithmetic with void pointers. >>>> > >>>> > There are a few places in common qemu code which does this for a very >>>> > long time. So I guess it is safe now. >>>> >>>> It's a non-standard GCC extension. >>> >>> So? We use many other GCC extensions. grep for typeof. >> >> Dependencies should not be introduced trivially. In this case, it's >> pretty easy to avoid void pointer arithmetic as Jan's next version >> shows. > > The standard is vague with respect void arithmetic. Most compilers > allow it. A very good analysis of the standard can be found below. > > http://stackoverflow.com/questions/3523145/pointer-arithmetic-for-void-pointer-in-c > > BTW: can we please stop arguing about C standards. If we currently are > using something in QEMU that's supported by clang and GCC, it's fine and > we ought to continue using it. Seconded. I don't see a point in making contributors avoid non-problems that might conceivably become trivial problems some day. Especially when there's no automated help with the avoiding. [...] From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:45541) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T6dcV-0002BK-2i for qemu-devel@nongnu.org; Wed, 29 Aug 2012 04:27:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T6dcQ-0008I0-EJ for qemu-devel@nongnu.org; Wed, 29 Aug 2012 04:27:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20622) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T6dcQ-0008Hd-5o for qemu-devel@nongnu.org; Wed, 29 Aug 2012 04:27:22 -0400 From: Markus Armbruster References: <825e653c9cfe9d8e26185917cbe1f1dd7ae299e2.1346048917.git.jan.kiszka@web.de> <503C74DD.3020307@msgid.tls.msk.ru> <20120828172838.GD3661@redhat.com> <87fw76ak5l.fsf@codemonkey.ws> Date: Wed, 29 Aug 2012 10:27:04 +0200 In-Reply-To: <87fw76ak5l.fsf@codemonkey.ws> (Anthony Liguori's message of "Tue, 28 Aug 2012 14:31:02 -0500") Message-ID: <878vcyrtlz.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH 4/4] kvm: i386: Add classic PCI device assignment List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: kvm@vger.kernel.org, "Michael S. Tsirkin" , Marcelo Tosatti , Michael Tokarev , qemu-devel@nongnu.org, Blue Swirl , Alex Williamson , Jan Kiszka , Avi Kivity Anthony Liguori writes: > Blue Swirl writes: > >> On Tue, Aug 28, 2012 at 5:28 PM, Michael S. Tsirkin wrote: >>> On Tue, Aug 28, 2012 at 05:01:55PM +0000, Blue Swirl wrote: >>>> On Tue, Aug 28, 2012 at 7:35 AM, Michael Tokarev wrote: >>>> > On 27.08.2012 22:56, Blue Swirl wrote: >>>> > [] >>>> >>> +static uint32_t slow_bar_readb(void *opaque, target_phys_addr_t addr) >>>> >>> +{ >>>> >>> + AssignedDevRegion *d = opaque; >>>> >>> + uint8_t *in = d->u.r_virtbase + addr; >>>> >> >>>> >> Don't perform arithmetic with void pointers. >>>> > >>>> > There are a few places in common qemu code which does this for a very >>>> > long time. So I guess it is safe now. >>>> >>>> It's a non-standard GCC extension. >>> >>> So? We use many other GCC extensions. grep for typeof. >> >> Dependencies should not be introduced trivially. In this case, it's >> pretty easy to avoid void pointer arithmetic as Jan's next version >> shows. > > The standard is vague with respect void arithmetic. Most compilers > allow it. A very good analysis of the standard can be found below. > > http://stackoverflow.com/questions/3523145/pointer-arithmetic-for-void-pointer-in-c > > BTW: can we please stop arguing about C standards. If we currently are > using something in QEMU that's supported by clang and GCC, it's fine and > we ought to continue using it. Seconded. I don't see a point in making contributors avoid non-problems that might conceivably become trivial problems some day. Especially when there's no automated help with the avoiding. [...]