[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH 07/11] xen: address MISRA C:2012 Rule 2.1


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Fri, 4 Aug 2023 08:42:52 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MipxFbC5XW6h6ZSCdyA1uHNCMDd+wtvdifl8Nc8zk8o=; b=mdfTz19GaVYXhkiRgmX91VbcHqiQtj3FlJTA+qfYsRe54jSnGX96I58ANGl89Idn89WbDZ+pgn+1ddIr1LZqY3M9W0nzum0BosaZ2NZhZDtwxnZOXdXhjOk8dKwFIhdNbks2pJfj7gGDTm9EuEu+ZzJkXeywVeMtj6oQqO/1Do5r/+gWA6iVE2iN3oK1EYCR8EVafUhnZZn9Sm5bBEJpyMfqD4tjrJ5PyVygh2hZD0g7X4WK47WoxylR/Q/xgys2OjQW+7o4UMmBlxoyVTZ6rIhg3bblZSoiQB4MifxtkA3q28thZ2HCbuXwk5+zH390zYwbzdMgGWUg2WX0hUWoHw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CNpQSb1DKdlGkCwkqyq1os1zxY3MqMRr0PUSZH9onK4vR8L9L5W6ReJU4p6O9Q7jCmQ6BCk7ppAXo4DxO0EZfPE8pVMB3r0M2w/hw9gs6+QlajaytFP/0UhlntJRgc5g5trro8Ma74f2Daa2jS5hldRZNmpSPO4ClHXshwWh3RJvhsYgEoAfXjbAKgJXs3mhQ/1ZFVNIsvS2t3smvcPpi3WfFhG0ePc6EqTjo3Gk7JfJVfV8A0WbR0Wu/CGK4DJWWugCR7XTZuEhvgC2Kn92qVqXjcWFAzxHyu8HSH+owDfvO2fVMRAqXmbuJNX/NNhGGTyN982ROl794DMWKYDnRQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>, michal.orzel@xxxxxxx, xenia.ragiadakou@xxxxxxx, ayan.kumar.halder@xxxxxxx, consulting@xxxxxxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Fri, 04 Aug 2023 06:43:06 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 04.08.2023 01:50, Stefano Stabellini wrote:
> On Thu, 3 Aug 2023, Jan Beulich wrote:
>> On 02.08.2023 16:38, Nicola Vetrini wrote:
>>> Rule 2.1 states: "A project shall not contain unreachable code".
>>>
>>> The functions
>>> - machine_halt
>>> - maybe_reboot
>>> - machine_restart
>>> are not supposed to return, hence the following break statement
>>> is marked as intentionally unreachable with the ASSERT_UNREACHABLE()
>>> macro to justify the violation of the rule.
>>
>> During the discussion it was mentioned that this won't help with
>> release builds, where right now ASSERT_UNREACHABLE() expands to
>> effectively nothing. You want to clarify here how release builds
>> are to be taken care of, as those are what eventual certification
>> will be run against.
> 
> Something along these lines:
> 
> ASSERT_UNREACHABLE(), not only is used in non-release builds to actually
> assert and detect errors, but it is also used as a marker to tag
> unreachable code. In release builds ASSERT_UNREACHABLE() doesn't resolve
> into an assert, but retains its role of a code marker.
> 
> Does it work?

Well, it states what is happening, but I'm not convinced it satisfies
rule 2.1. There's then still code there which isn't reachable, and
which a scanner will spot and report.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.