Received: from eggs.gnu.org ([2001:4830:134:3::10]:34038) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpGjD-0007gB-Sm for qemu-devel@nongnu.org; Mon, 04 May 2015 09:48:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YpGj9-000093-6A for qemu-devel@nongnu.org; Mon, 04 May 2015 09:48:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42832) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YpGj9-00008l-0t for qemu-devel@nongnu.org; Mon, 04 May 2015 09:48:07 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 2FA358E79E for ; Mon, 4 May 2015 13:48:06 +0000 (UTC) From: Markus Armbruster References: <1430741889-11484-1-git-send-email-pbonzini@redhat.com> Date: Mon, 04 May 2015 15:48:03 +0200 In-Reply-To: <1430741889-11484-1-git-send-email-pbonzini@redhat.com> (Paolo Bonzini's message of "Mon, 4 May 2015 14:18:09 +0200") Message-ID: <87y4l48ne4.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH] coverity: fix address_space_rw model List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org Paolo Bonzini writes: > If the is_write argument is true, address_space_rw writes to memory > and thus reads from the buffer. The opposite holds if is_write is > false. Fix the model. > > Cc: Markus Armbruster > Signed-off-by: Paolo Bonzini > --- > scripts/coverity-model.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/scripts/coverity-model.c b/scripts/coverity-model.c > index 224d2d1..617f67d 100644 > --- a/scripts/coverity-model.c > +++ b/scripts/coverity-model.c > @@ -49,7 +49,7 @@ typedef uint64_t hwaddr; > typedef uint32_t MemTxResult; > typedef uint64_t MemTxAttrs; > > -static void __write(uint8_t *buf, ssize_t len) > +static void __bufwrite(uint8_t *buf, ssize_t len) > { > int first, last; > __coverity_negative_sink__(len); > @@ -59,7 +59,7 @@ static void __write(uint8_t *buf, ssize_t len) > __coverity_writeall__(buf); > } > > -static void __read(uint8_t *buf, ssize_t len) > +static void __bufread(uint8_t *buf, ssize_t len) > { > __coverity_negative_sink__(len); > if (len == 0) return; > @@ -74,7 +74,7 @@ MemTxResult address_space_rw(AddressSpace *as, hwaddr addr, MemTxAttrs attrs, > > // TODO: investigate impact of treating reads as producing > // tainted data, with __coverity_tainted_data_argument__(buf). > - if (is_write) __write(buf, len); else __read(buf, len); > + if (is_write) __bufread(buf, len); else __bufwrite(buf, len); > > return result; > } Good one :) I can take this through my tree. Thanks!