From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH 4/5] tmem: Pointless check of NULL against an array Date: Mon, 25 Nov 2013 17:19:32 +0000 Message-ID: <529386A4.9020005@citrix.com> References: <1385398842-8247-1-git-send-email-konrad.wilk@oracle.com> <1385398842-8247-5-git-send-email-konrad.wilk@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1VkzpF-0002EZ-1T for xen-devel@lists.xenproject.org; Mon, 25 Nov 2013 17:19:57 +0000 In-Reply-To: <1385398842-8247-5-git-send-email-konrad.wilk@oracle.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: Konrad Rzeszutek Wilk Cc: xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org 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 )" ~Andrew > if ( pool_id >= MAX_POOLS_PER_DOMAIN ) > return 0; > if ( (pool = client->pools[pool_id]) == NULL )