All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicola Vetrini <nicola.vetrini@bugseng.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: michal.orzel@amd.com, xenia.ragiadakou@amd.com,
	ayan.kumar.halder@amd.com, consulting@bugseng.com,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	George Dunlap <george.dunlap@citrix.com>,
	Julien Grall <julien@xen.org>, Wei Liu <wl@xen.org>,
	xen-devel@lists.xenproject.org,
	Stefano Stabellini <sstabellini@kernel.org>
Subject: Re: [XEN PATCH] xen/types: address Rule 10.1 for macro BITS_TO_LONGS
Date: Fri, 08 Sep 2023 16:53:09 +0200	[thread overview]
Message-ID: <3d44b3b0b185418482ab60a693d930a9@bugseng.com> (raw)
In-Reply-To: <7d07fc38-14e8-6cc7-2b0c-816bc68c7317@suse.com>

On 08/09/2023 13:59, Jan Beulich wrote:
> On 08.09.2023 13:57, Jan Beulich wrote:
>> On 08.09.2023 10:48, Nicola Vetrini wrote:
>>> There is a build error due to -Werror because of a pointer comparison 
>>> at
>>> line 469 of common/numa.c:
>>> i = min(PADDR_BITS, BITS_PER_LONG - 1);
>>> where
>>> #define PADDR_BITS              52
>>> 
>>> I guess PADDR_BITS can become unsigned or gain a cast
>> 
>> While generally converting constants to unsigned comes with a certain
>> risk, I think for this (and its siblings) this ought to be okay. As to
>> the alternative of a cast - before considering that, please consider
>> e.g. adding 0u (as we do elsewhere in the code base to deal with such
>> cases).
> 
> And just after sending I realized that this would still be disliked by
> Misra's type system. (Much like then aiui the 1 above will need to
> become 1u. Which is all pretty horrible.)
> 
> Jan

I have a proposal: in our tests we enabled an ECLAIR configuration that 
allows to bypass the
constraint imposed by Rule 10.4 that warrants the 1U iff the value is 
constant and both types
can represent it correctly (in this case BITS_PER_LONG -1). This would 
allow using the proposed
solution and documenting why it's ok not to respect R10.4. What do you 
think?

-- 
Nicola Vetrini, BSc
Software Engineer, BUGSENG srl (https://bugseng.com)


  reply	other threads:[~2023-09-08 14:53 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-05  7:31 [XEN PATCH] xen/types: address Rule 10.1 for macro BITS_TO_LONGS Nicola Vetrini
2023-09-05  7:46 ` Jan Beulich
2023-09-05  8:20   ` Nicola Vetrini
2023-09-05  8:33     ` Jan Beulich
2023-09-06 15:57       ` Nicola Vetrini
2023-09-06 16:02         ` Jan Beulich
2023-09-07  1:33           ` Stefano Stabellini
2023-09-07  6:42             ` Jan Beulich
2023-09-08  8:48             ` Nicola Vetrini
2023-09-08 11:57               ` Jan Beulich
2023-09-08 11:59                 ` Jan Beulich
2023-09-08 14:53                   ` Nicola Vetrini [this message]
2023-09-08 15:09                     ` Nicola Vetrini
2023-09-11  6:43                       ` Jan Beulich
2023-09-08 19:37                     ` Stefano Stabellini
2023-09-19  9:19                       ` Nicola Vetrini
2023-09-19  9:33                         ` Jan Beulich
2023-09-19  9:54                           ` Nicola Vetrini
2023-09-19  9:59                             ` Jan Beulich
2023-10-04 13:23 ` Nicola Vetrini
2023-10-16 10:31   ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3d44b3b0b185418482ab60a693d930a9@bugseng.com \
    --to=nicola.vetrini@bugseng.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ayan.kumar.halder@amd.com \
    --cc=consulting@bugseng.com \
    --cc=george.dunlap@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    --cc=xenia.ragiadakou@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.