Received: from eggs.gnu.org ([2001:4830:134:3::10]:38443) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLq3E-0006WG-7c for qemu-devel@nongnu.org; Thu, 12 Feb 2015 04:27:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLq39-0004WJ-8b for qemu-devel@nongnu.org; Thu, 12 Feb 2015 04:27:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54442) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLq39-0004Um-0j for qemu-devel@nongnu.org; Thu, 12 Feb 2015 04:27:07 -0500 From: Markus Armbruster References: <1423672645-12452-1-git-send-email-kraxel@redhat.com> <54DB8656.8050401@redhat.com> <1423673296.15339.11.camel@nilsson.home.kraxel.org> Date: Thu, 12 Feb 2015 10:27:02 +0100 In-Reply-To: <1423673296.15339.11.camel@nilsson.home.kraxel.org> (Gerd Hoffmann's message of "Wed, 11 Feb 2015 17:48:16 +0100") Message-ID: <878ug3bhuh.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH] vnc: fix coverity warning List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: Paolo Bonzini , qemu-devel@nongnu.org, Anthony Liguori Gerd Hoffmann writes: >> > + assert(vs); >> > return vnc_socket_local_addr("%s:%s", vs->lsock); >> > } >> > >> > >> >> If you want, I can just silence the warning in Coverity. > > I think in the source code is better, human readers might wonder too. > > And in case the calling code ever changes behavior the assert will trap > it (even though it is highly unlikely in this specific case). I'm very much in favor of using assertions to guide Coverity. Besides human readers, they may also help other static analyzers, including optimizers. Speaking of silencing defects: we could also explore use of code annotations. Example given in the manual: x = NULL; ... // coverity[var_deref_op] *x = 0; The comment automatically classifies the FORWARD_NULL as intentional.