From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 3/9] virt/kvm: correct error-handling code Date: Wed, 09 Sep 2009 17:42:19 +0300 Message-ID: <4AA7BECB.2090903@redhat.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org To: Julia Lawall Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 07/28/2009 06:53 PM, Julia Lawall wrote: > From: Julia Lawall > > This code is not executed before file has been initialized to the result of > calling eventfd_fget. This function returns an ERR_PTR value in an error > case instead of NULL. Thus the test that file is not NULL is always true. > > A simplified version of the semantic match that finds this problem is as > follows: (http://coccinelle.lip6.fr/) > > // > @match exists@ > expression x, E; > statement S1, S2; > @@ > > x = eventfd_fget(...) > ... when != x = E > ( > * if (x == NULL || ...) S1 else S2 > | > * if (x == NULL&& ...) S1 else S2 > ) > // > > Applied, thanks (yes, old patch, missed it). -- error compiling committee.c: too many arguments to function