From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH 4/5] tmem: Pointless check of NULL against an array Date: Mon, 25 Nov 2013 14:54:29 -0500 Message-ID: <20131125195429.GE3339@phenom.dumpdata.com> References: <1385398842-8247-1-git-send-email-konrad.wilk@oracle.com> <1385398842-8247-5-git-send-email-konrad.wilk@oracle.com> <529386A4.9020005@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Vl2Ev-0008EF-WB for xen-devel@lists.xenproject.org; Mon, 25 Nov 2013 19:54:38 +0000 Content-Disposition: inline In-Reply-To: <529386A4.9020005@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org On Mon, Nov 25, 2013 at 05:19:32PM +0000, Andrew Cooper wrote: > On 25/11/13 17:00, Konrad Rzeszutek Wilk wrote: > > CID 1055632 tells us that we are comparing an array to a NULL > > which is indeed silly. Lets not do it. > > > > CC: Bob Liu > > Signed-off-by: Konrad Rzeszutek Wilk > > --- > > xen/common/tmem.c | 2 -- > > 1 file changed, 2 deletions(-) > > > > diff --git a/xen/common/tmem.c b/xen/common/tmem.c > > index 3bc35fd..1ebed8a 100644 > > --- a/xen/common/tmem.c > > +++ b/xen/common/tmem.c > > @@ -1798,8 +1798,6 @@ static int do_tmem_destroy_pool(uint32_t pool_id) > > struct client *client = tmem_client_from_current(); > > struct tmem_pool *pool; > > > > - if ( client->pools == NULL ) > > - return 0; > > client->pools certainly can't be null, but client certainly can. This > should be "if ( !client )" No need. The caller of this function does that already and if there does not exist one - it will create one. I can add an ASSERT here? > > ~Andrew > > > if ( pool_id >= MAX_POOLS_PER_DOMAIN ) > > return 0; > > if ( (pool = client->pools[pool_id]) == NULL ) >