From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH v2 4/5] IOMMU/x86: correct page_list_first() use Date: Mon, 2 Feb 2015 11:52:14 +0000 Message-ID: <54CF64EE.6060602@citrix.com> References: <54CF68DF020000780005BD6C@mail.emea.novell.com> <54CF6B9F020000780005BDBD@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YIFYB-0007LT-5F for xen-devel@lists.xenproject.org; Mon, 02 Feb 2015 11:52:19 +0000 In-Reply-To: <54CF6B9F020000780005BDBD@mail.emea.novell.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: Jan Beulich , xen-devel Cc: Tim Deegan , Keir Fraser List-Id: xen-devel@lists.xenproject.org On 02/02/15 11:20, Jan Beulich wrote: > Comparing its result against NULL is unsafe when page lists use normal > list entries for linking together - page_list_empty() needs to be used > instead. > > Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper > > --- a/xen/drivers/passthrough/x86/iommu.c > +++ b/xen/drivers/passthrough/x86/iommu.c > @@ -85,8 +85,9 @@ int arch_iommu_populate_page_table(struc > * first few entries. > */ > page_list_move(&d->page_list, &d->arch.relmem_list); > - while ( (page = page_list_first(&d->page_list)) != NULL && > - (page->count_info & (PGC_state|PGC_broken)) ) > + while ( !page_list_empty(&d->page_list) && > + (page = page_list_first(&d->page_list), > + (page->count_info & (PGC_state|PGC_broken))) ) > { > page_list_del(page, &d->page_list); > page_list_add_tail(page, &d->arch.relmem_list); > > >