From nobody Sun May 19 01:26:44 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1699919132; cv=none; d=zohomail.com; s=zohoarc; b=A7GiKlxnQ0d6+hSuNxkjISd6CGyBjsH2UlFlYGT5HszK7JSH3LPQ7rjNO4P3/jc220laBieRqQns1dlATZrIqOiyv95WJgaobLDU2tDLnIqS51dXE+Z6wJSInvvOk75foswTTw7BqgPeKHhqYR0WyGn61p0I6grHlkD6haDQ6bo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1699919132; h=Content-Type:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=98PnscpsC+Qp4rZ5Axp1dGEXdKE7eQP5uG90HnJSSyU=; b=OGA6d/loZcae53lzSGRjMUgAeNGMBuxgU8f9BOQoXRTVVsBoJeUoWD3Mm1R0eLklz19i5GoyT9+SGcEnmVXFTpwT4ujchBJnP7PDwLCu8R0pzZ86F02LWTfI5ud7axuRj5Iep3qJVd2QfDLXobQYLVZM0WbcRrGXQQ5xCO7whkk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1699919132305645.7026330394043; Mon, 13 Nov 2023 15:45:32 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.632072.986022 (Exim 4.92) (envelope-from ) id 1r2gbw-00007d-2Z; Mon, 13 Nov 2023 23:44:56 +0000 Received: by outflank-mailman (output) from mailman id 632072.986022; Mon, 13 Nov 2023 23:44:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r2gbv-00007W-Vk; Mon, 13 Nov 2023 23:44:55 +0000 Received: by outflank-mailman (input) for mailman id 632072; Mon, 13 Nov 2023 23:44:55 +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 1r2gbu-00007Q-Vz for xen-devel@lists.xenproject.org; Mon, 13 Nov 2023 23:44:54 +0000 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id a299309b-827e-11ee-9b0e-b553b5be7939; Tue, 14 Nov 2023 00:44:50 +0100 (CET) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by ams.source.kernel.org (Postfix) with ESMTP id 88E0AB80EB7; Mon, 13 Nov 2023 23:44:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5359C433C7; Mon, 13 Nov 2023 23:44:47 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version 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: a299309b-827e-11ee-9b0e-b553b5be7939 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1699919088; bh=voyOJVCSVfVQEPaPCOqvBXShmeGZTsBDSJ+ki1IsNT0=; h=Date:From:To:cc:Subject:From; b=ryY8pkZXxhMVZqUakTVaxHGvRYkLDtEC5xEa18EDgF5GawUg+cgFJs+Z7mtH8AIIN KXUl1bwbBgyLsUSH5rUZaeXSxb/8GUxRQdnGgIBTsy9NZp2LMI61IzSpZFUmgR/zI3 qRqVMBVfmNeWFFzY6CoMxePc7sWGlKk7v/UPbmcN/bT9ln7FnweXAFSOGNFHrHKXy8 xTtYaVW8ZnZzYuj80U1kAM7EfRJKr59Sc8v3AiLwuQ86anK09PHCN1LuC18/cEcR47 yLKzih3cQATYc11SMTvkgpwqC3/HhLxsI3aODPvWHMUMn+xyEKdHYCW5qpwUY90Pqq j7krs14PEAhgg== Date: Mon, 13 Nov 2023 15:44:45 -0800 (PST) From: Stefano Stabellini X-X-Sender: sstabellini@ubuntu-linux-20-04-desktop To: xen-devel@lists.xenproject.org cc: sstabellini@kernel.org, Jan Beulich , Andrew Cooper , =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= , Julien Grall , Bertrand Marquis Subject: [PATCH] docs/misra: add R11.1 R11.2 R11.3 R11.6 Message-ID: User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1699919134080100001 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add MISRA C Rules 11.1, 11.2, 11.3, 11.6 as discussed. Explicitly add in the notes that conversions to integer types are permitted if the destination type has enough bits to hold the entire value. GCC gives enough guarantees in terms of preserving the bit content in such situations. Also allow for bool conversions (e.g. to check if a function point is valid). Signed-off-by: Stefano Stabellini diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst index aa65eb4dd0..8c49b81085 100644 Acked-by: Jan Beulich --- a/docs/misra/rules.rst +++ b/docs/misra/rules.rst @@ -383,6 +383,38 @@ maintainers if you want to suggest a change. =20 CFLAGS=3D"-Warith-conversion -Wno-error=3Darith-conversion" make -C= xen =20 + * - `Rule 11.1 `_ + - Required + - Conversions shall not be performed between a pointer to a + function and any other type + - All conversions to integer types are permitted if the destination + type has enough bits to hold the entire value. Conversions to + bool and void* are permitted. + + * - `Rule 11.2 `_ + - Required + - Conversions shall not be performed between a pointer to an + incomplete type and any other type + - All conversions to integer types are permitted if the destination + type has enough bits to hold the entire value. Conversions to + bool and void* are permitted. + + * - `Rule 11.3 `_ + - Required + - A cast shall not be performed between a pointer to object type + and a pointer to a different object type + - All conversions to integer types are permitted if the destination + type has enough bits to hold the entire value. Conversions to + bool and void* are permitted. + + * - `Rule 11.6 `_ + - Required + - A cast shall not be performed between pointer to void and an + arithmetic type + - All conversions to integer types are permitted if the destination + type has enough bits to hold the entire value. Conversions to + bool and void* are permitted. + * - `Rule 11.7 `_ - Required - A cast shall not be performed between pointer to object and a nonin= teger arithmetic type