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 657A3CEB2FE for ; Tue, 1 Oct 2024 06:32:26 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.807734.1219357 (Exim 4.92) (envelope-from ) id 1svWQk-0006Pq-NX; Tue, 01 Oct 2024 06:32:18 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 807734.1219357; Tue, 01 Oct 2024 06:32:18 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1svWQk-0006Pj-Kk; Tue, 01 Oct 2024 06:32:18 +0000 Received: by outflank-mailman (input) for mailman id 807734; Tue, 01 Oct 2024 06:32:17 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1svWQj-0006Pd-Ba for xen-devel@lists.xenproject.org; Tue, 01 Oct 2024 06:32:17 +0000 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [2a00:1450:4864:20::62f]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id e62553c6-7fbe-11ef-99a2-01e77a169b0f; Tue, 01 Oct 2024 08:32:15 +0200 (CEST) Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-a86e9db75b9so967768566b.1 for ; Mon, 30 Sep 2024 23:32:15 -0700 (PDT) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a93c2775d23sm652331166b.4.2024.09.30.23.32.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 30 Sep 2024 23:32:14 -0700 (PDT) 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: e62553c6-7fbe-11ef-99a2-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1727764335; x=1728369135; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=rPf8JphMMaG1HIFqoHxUuiHW3PDeMWgjRaCIs+S372U=; b=aLKAepyRiOnDRcagMf5E/gIzgixZbxM4DayeRs+xyOuE0HaUOL3LyowiXrEyQ4rm6l r6+Ewo+Qjzjn9V07oEAnvEeqO8kmnix9Hd2PwtXywFaYR2NjtrwqdQrb6EicDnlu13j0 XelHr5sSSb14wbWSxDhjcOC+plJuivEYq4yiG4U8Xxls65Z40JJZGgZHbx+xGciKA0zj lxfLLZP+74VdPL2XZX1Z3sdBIvZv65FoS5+ee+3GwGMKnoqeo8YdDgDSZmK55v3ABgSA 26cXO4U23bUTDoeGWv7Go1T2KS8t8n++boQU5Qk6CYHdINsPJJx10aKNCyv3wWZTB4Wk MKWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727764335; x=1728369135; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=rPf8JphMMaG1HIFqoHxUuiHW3PDeMWgjRaCIs+S372U=; b=RbkCBbyihEF8iyzQJDr86fGUZJ1KF1NZ53zBFB3QDzi33MTxc192AP/MPA2oIN3wiT ro3cd76Hk0rla3xcBTbUCLPY2aNzXUdf/d3TXX41h0dTcEDgY1pabntDEgw0wwbV6Zz/ 75BSuuGpGRC6U1CtLV4TAaZKaJ0/eEjAlmUE2pvhnSmxK1YF3glhVEeC1QeYiIjAIQul gTMFkQGkbgDjoMSlHvZ1gtsOOXOPdtAegnTsyjQPSN7kQv9+v2Xo8CXsAXTjmIIQEKro cH3EMJD+k52uwp08w7yuz+ZdPv/imyp6zQySg+mvtN6ff6or5bcff+i9hQ8i5piw+WgP Ci8g== X-Forwarded-Encrypted: i=1; AJvYcCV49ixHaZbQ3TCXkKsMi8ZlIwO108pDth9gFiyKjGP/YTk6ZGCY3CmhU4dxllXGwRcvKz7KI6XIZds=@lists.xenproject.org X-Gm-Message-State: AOJu0Ywt6zMxZcZZwdN2+csWMxzMC542j1ApFc9CR/aCmUgRITymJ3ch vJQ1S6VLNbxTolujmNMoaLIUNIwT9IE5NRQTfie6usciueKXy7my/LnW8ljT6Q== X-Google-Smtp-Source: AGHT+IGKli2++IfpWNTtTd9sMbTfHPF5i+latI4NG+eq5cx9vJnd5La69x9uR5j9fS7vYnVZl4blug== X-Received: by 2002:a17:907:1ca7:b0:a8d:28dc:9e2b with SMTP id a640c23a62f3a-a93c4a68381mr1783607766b.44.1727764334930; Mon, 30 Sep 2024 23:32:14 -0700 (PDT) Message-ID: <8d5e4761-9fc2-4e18-a6c2-9df1822dbbea@suse.com> Date: Tue, 1 Oct 2024 08:32:13 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [XEN PATCH v2 1/3] EFI: address a violation of MISRA C Rule 13.6 To: Roberto Bagnara , Federico Serafini Cc: consulting@bugseng.com, "Daniel P. Smith" , =?UTF-8?Q?Marek_Marczykowski-G=C3=B3recki?= , Stefano Stabellini , Andrew Cooper , xen-devel@lists.xenproject.org References: Content-Language: en-US From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xC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ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 01.10.2024 07:25, Roberto Bagnara wrote: > On 2024-09-30 15:07, Jan Beulich wrote: >> On 30.09.2024 14:49, Federico Serafini wrote: >>> guest_handle_ok()'s expansion contains a sizeof() involving its >>> first argument which is guest_handle_cast(). >>> The expansion of the latter, in turn, contains a variable >>> initialization. >>> >>> Since MISRA considers the initialization (even of a local variable) >>> a side effect, the chain of expansions mentioned above violates >>> MISRA C:2012 Rule 13.6 (The operand of the `sizeof' operator shall not >>> contain any expression which has potential side effect). >> >> I'm afraid I need to ask for clarification of terminology and alike here. >> While the Misra doc has a section on Persistent Side Effects in its >> Glossary appendix, what constitutes a side effect from its pov isn't >> really spelled out anywhere. Which in turn raises the question whether it >> is indeed Misra (and not just Eclair) which deems initialization a side >> effect. This is even more so relevant as 13.6 talks of only expressions, >> yet initializers fall under declarations (in turn involving an expression >> on the rhs of the equal sign). >> >> All the same of course affects patch 2 then, too. > > MISRA C leaves the definition of "side effect" to the C Standard. > E.g., C18 5.1.2.3p2: > > Accessing a volatile object, modifying an object, modifying a file, > or calling a function that does any of those operations are all > side effects,[omitted irrelevant footnote reference] which are > changes in the state of the execution environment. > > The MISRA C:2012/2023 Glossary entry for "Persistent side effect" > indirectly confirms that initialization is always a side effect. Hmm, that's interesting: There's indeed an example with an initializer there. Yet to me the text you quote from the C standard does not say that initialization is a side effect - it would be "modifying an object" aiui, yet ahead of initialization being complete the object doesn't "exist" imo, and hence can be "modified" only afterwards. Jan