Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 99986C4321E for ; Thu, 1 Dec 2022 21:59:10 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.451256.708916 (Exim 4.92) (envelope-from ) id 1p0ra9-0007Ab-DW; Thu, 01 Dec 2022 21:59:01 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 451256.708916; Thu, 01 Dec 2022 21:59:01 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p0ra9-0007AU-AY; Thu, 01 Dec 2022 21:59:01 +0000 Received: by outflank-mailman (input) for mailman id 451256; Thu, 01 Dec 2022 21:59:00 +0000 Received: from mail.xenproject.org ([104.130.215.37]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p0ra8-0007AN-0E for xen-devel@lists.xenproject.org; Thu, 01 Dec 2022 21:59:00 +0000 Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1p0ra7-000512-EE; Thu, 01 Dec 2022 21:58:59 +0000 Received: from gw1.octic.net ([88.97.20.152] helo=[10.0.1.102]) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1p0ra7-0002Rk-83; Thu, 01 Dec 2022 21:58:59 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:From: References:Cc:To:Subject:MIME-Version:Date:Message-ID; bh=z31vgeUtwP7PlNo7T3SR2TqLSJGlpOUXOn7D0ezub7E=; b=QVqhlIwwzrJMzEFJOL2pDhRhSY X07ygzqnVblHsI/m7rWPkwiB4aVG6QFGw3Z58rjpQBrSOIDPVuw7+jCSC0XRMaW5jN3UkCsbpw2uK JlDNrHAqk2I6WbdvHGewR0SKuipcHwar2zUJtSorFQcMiQrqxSkro59djVBnXY6cXAcg=; Message-ID: <6bad7b3c-eaa2-d342-a7f2-d265bdefd54a@xen.org> Date: Thu, 1 Dec 2022 21:58:57 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH 11/20] tools/xenstore: move changed domain handling To: Juergen Gross , xen-devel@lists.xenproject.org Cc: Wei Liu , Anthony PERARD References: <20221101152842.4257-1-jgross@suse.com> <20221101152842.4257-12-jgross@suse.com> From: Julien Grall In-Reply-To: <20221101152842.4257-12-jgross@suse.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Juergen, On 01/11/2022 15:28, Juergen Gross wrote: > static bool check_indexes(XENSTORE_RING_IDX cons, XENSTORE_RING_IDX prod) > @@ -492,8 +504,12 @@ static struct domain *find_or_alloc_existing_domain(unsigned int domid) > xc_dominfo_t dominfo; > > domain = find_domain_struct(domid); > - if (!domain && get_domain_info(domid, &dominfo)) > - domain = alloc_domain(NULL, domid); > + if (!domain) { > + if (!get_domain_info(domid, &dominfo)) > + errno = ENOENT; > + else > + domain = alloc_domain(NULL, domid); > + } I don't understand how this change is related to this commit. [...] > +int acc_add_dom_nbentry(const void *ctx, struct list_head *head, int val, > + unsigned int domid) > +{ > + struct changed_domain *cd; > + > + cd = acc_get_changed_domain(ctx, head, domid); > + if (!cd) > + return errno; > + > + cd->nbentry += val; As a future improvement, it would be worth considering to check for underflow/overflow. Cheers, -- Julien Grall