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

Re: [PATCH v3] docs/misra: add rule 2.1 exceptions


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 11 Sep 2023 09:17:20 +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=tILWl3DKuD/GJaIYzaUKvdLRDDsfsIeahERO5i2AkL8=; b=iOR1rjSwU3wXiR+rqGIa6jOBQSTi3EgCxEGZYs9q6CtjDBwRMwGrxg0teIU8RlRsiYhC45r4EyasV4UFMmBB29lxsdEMyHxHdi76JNo18TRhllksWdSEVODTJ9RDsSPbDLB7ebFb2wIi0KiPQ43HPSDVBRieWAxvk1HyT0oDK/92NDhzzbLm7Ll4/SHwfBE+e3dHn60yo+vI1loJGGVIq8tQIHHOaGQxwDrbldIVLkMAKQnuiNYBGCkDy7PsFwkY90HEyIvBPNjtNCiSn7NfsccOjywh1/3TPNjWu1eekn9aHFcE0OH8ARoJHQo4lBSgTMyXosJrJzcVHHP6KsuaeQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WRehhgLpCOH5eCbhccVd0IF4SaIenU6D0Veqi+hT1rHxpe6ukffuXiv4EP0zmQpIRzRa+TvmIb7VeqWlHQb6pdbsBaPY3xBo5Z/6VhDuxc53zoGgCl3hITbT9aQ08O/ox4v0TbXsvh6mekydFWQMKN8yY6P8GkmCwVVGbFZAmHe/0G6qiZcbTQ9e+GtIHTg3+02ikZwT9qY6D4YCyUxOxXjjBZJCkOzFw/PxetsCnJ3RtP0zx/X48qCzzV/B1jhIL1dip95fj1RDZrHeZnu5AlFhF74obcz15CM/CWMLzAC4DrW9dJcdRqpAZ/8zQdBbkxW387H63RHwggqzNqfk1Q==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: andrew.cooper3@xxxxxxxxxx, roger.pau@xxxxxxxxxx, julien@xxxxxxx, george.dunlap@xxxxxxxxxx, bertrand.marquis@xxxxxxx, roberto.bagnara@xxxxxxxxxxx, nicola.vetrini@xxxxxxxxxxx, Stefano Stabellini <stefano.stabellini@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 11 Sep 2023 07:17:38 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 09.09.2023 01:03, Stefano Stabellini wrote:
> From: Stefano Stabellini <stefano.stabellini@xxxxxxx>
> 
> During the discussions that led to the acceptance of Rule 2.1, we
> decided on a few exceptions that were not properly recorded in
> rules.rst. Add them now.
> 
> Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxx>
> Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
> ---
> Nicola, does this work with ECLAIR?
> 
> I am referring to the locations of the SAF-2-safe tag on top of
> call_psci_system_off, BUG, etc.
> 
> Changes in v3:
> - added SAF-2-safe to safe.json
> - added a few SAF-2-safe examples
> ---
>  docs/misra/rules.rst    | 13 ++++++++++++-
>  docs/misra/safe.json    |  8 ++++++++
>  xen/arch/arm/psci.c     |  1 +
>  xen/arch/x86/shutdown.c |  1 +
>  xen/include/xen/bug.h   |  2 ++
>  5 files changed, 24 insertions(+), 1 deletion(-)
> 
> diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
> index 34916e266a..82de4c645d 100644
> --- a/docs/misra/rules.rst
> +++ b/docs/misra/rules.rst
> @@ -107,7 +107,18 @@ maintainers if you want to suggest a change.
>     * - `Rule 2.1 
> <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_02_01_1.c>`_
>       - Required
>       - A project shall not contain unreachable code
> -     -
> +     - The following are allowed:
> +         - Invariantly constant conditions, e.g. if(IS_ENABLED(CONFIG_HVM)) 
> { S; }
> +         - Switch with a controlling value statically determined not to
> +           match one or more case statements

I (continue to) consider this as too lax. I don't think we want to permit
something like

void test(uint8_t val)
{
    switch ( val )
    {
    case 0x100:
        ...

Imo like in the earlier bullet point I think this wants limiting to
compile-time constant values, at least initially.

Jan



 


Rackspace

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