From mboxrd@z Thu Jan 1 00:00:00 1970 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 64F53CDB482 for ; Wed, 18 Oct 2023 12:30:15 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.618541.962292 (Exim 4.92) (envelope-from ) id 1qt5gc-0004Ai-Ue; Wed, 18 Oct 2023 12:30:06 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 618541.962292; Wed, 18 Oct 2023 12:30:06 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qt5gc-0004Ab-RD; Wed, 18 Oct 2023 12:30:06 +0000 Received: by outflank-mailman (input) for mailman id 618541; Wed, 18 Oct 2023 12:30:05 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qt5gb-0003E8-5H for xen-devel@lists.xenproject.org; Wed, 18 Oct 2023 12:30:05 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 10596059-6db2-11ee-98d4-6d05b1d4d9a1; Wed, 18 Oct 2023 14:30:04 +0200 (CEST) Received: from support.bugseng.com (support.bugseng.com [162.55.131.47]) by support.bugseng.com (Postfix) with ESMTPA id BA38D4EE0738; Wed, 18 Oct 2023 14:30:03 +0200 (CEST) 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" X-Inumbo-ID: 10596059-6db2-11ee-98d4-6d05b1d4d9a1 MIME-Version: 1.0 Date: Wed, 18 Oct 2023 14:30:03 +0200 From: Nicola Vetrini To: Julien Grall Cc: Jan Beulich , Andrew Cooper , Xen-devel , consulting@bugseng.com, Stefano Stabellini , Bertrand Marquis , roger.pau@citrix.com, George Dunlap , Wei Liu Subject: Re: MISRA C:2012 D4.11 caution on staging In-Reply-To: <3573c8c2-1a9c-444c-a542-539b16f689f2@xen.org> References: <7972c20f361126022fa97f6b51ca2d9c@bugseng.com> <61f04d4b-34d9-4fd1-a989-56b042b4f3d8@citrix.com> <26f09702-9340-41ae-afcc-808becb67876@citrix.com> <75a00257-c062-4d82-9b64-1707ce4566e6@xen.org> <594c09e1f8b2e1e8321c2cb862fcb378@bugseng.com> <5ddb6398-f2a3-4bcb-8808-bad653b6c3cd@xen.org> <3573c8c2-1a9c-444c-a542-539b16f689f2@xen.org> User-Agent: Roundcube Webmail/1.4.3 Message-ID: <8c25bfd7768d6b290362f56a8b8d44d9@bugseng.com> X-Sender: nicola.vetrini@bugseng.com Organization: BUGSENG s.r.l. Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit On 17/10/2023 15:28, Julien Grall wrote: > Hi Jan, > > On 17/10/2023 07:11, Jan Beulich wrote: >> On 16.10.2023 20:06, Julien Grall wrote: >>> Instead, it would be best to find a way to help Eclair to detect this >>> is >>> not an issue and also improve readability. Would the following help >>> Eclair? >>> >>> diff --git a/xen/common/domain.c b/xen/common/domain.c >>> index 30c227967345..ab16124eabd6 100644 >>> --- a/xen/common/domain.c >>> +++ b/xen/common/domain.c >>> @@ -671,6 +671,8 @@ struct domain *domain_create(domid_t domid, >>> >>> if ( !is_idle_domain(d) ) >>> { >>> + ASSERT(config); >>> + >>> watchdog_domain_init(d); >>> init_status |= INIT_watchdog; >> >> Just to mention it: Even if right now it turned out to help, it >> wouldn't >> once release builds are also checked. > > Indeed. I thought about it when writing the e-mail yesterday. I have > the feeling that we are not getting many similar report today thanks > to the various ASSERT(). > > This may mean that the ASSERT() will have to be kept during static > analysis or we deviate/add proper error checking. > > Cheers, I tested this, and the report is prevented by the ASSERT. It's up to the maintainers to decide how do you want to proceed: my suggestion is deviating it, and then when someone has the time to fix this with proper error handling remove the deviation. -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)