From: "Alejandro Vallejo" <alejandro.vallejo@cloud.com>
To: "Jan Beulich" <jbeulich@suse.com>,
"Federico Serafini" <federico.serafini@bugseng.com>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Roger Pau Monné" <roger.pau@citrix.com>
Cc: <consulting@bugseng.com>, <xen-devel@lists.xenproject.org>
Subject: Re: [XEN PATCH v3 09/12] x86/mm: add defensive return
Date: Tue, 09 Jul 2024 12:21:44 +0100 [thread overview]
Message-ID: <D2KYW63EJC2X.2BK8GEXKZW2N@cloud.com> (raw)
In-Reply-To: <4cc9a5c7-df57-4a90-8164-cf3002596870@suse.com>
On Mon Jul 1, 2024 at 9:57 AM BST, Jan Beulich wrote:
> On 26.06.2024 11:28, Federico Serafini wrote:
> > Add defensive return statement at the end of an unreachable
> > default case. Other than improve safety, this meets the requirements
> > to deviate a violation of MISRA C Rule 16.3: "An unconditional `break'
> > statement shall terminate every switch-clause".
> >
> > Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
>
> Tentatively
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
>
> > --- a/xen/arch/x86/mm.c
> > +++ b/xen/arch/x86/mm.c
> > @@ -916,6 +916,7 @@ get_page_from_l1e(
> > return 0;
> > default:
> > ASSERT_UNREACHABLE();
> > + return -EPERM;
> > }
> > }
> > else if ( l1f & _PAGE_RW )
>
> I don't like the use of -EPERM here very much, but I understand that there's
> no really suitable errno value. I wonder though whether something far more
> "exotic" wouldn't be better in such a case, say -EBADMSG or -EADDRNOTAVAIL.
> Just to mention it: -EPERM is what failed XSM checks would typically yield,
> so from that perspective alone even switching to -EACCES might be a little
> bit better.
>
fwiw: EACCES, being typically used for interface version mismatches, would
confuse me a lot.
> I further wonder whether, with the assertion catching an issue with the
> implementation, we shouldn't consider using BUG() here instead. Input from
> in particular the other x86 maintainers appreciated.
>
> Jan
Cheers,
Alejandro
next prev parent reply other threads:[~2024-07-09 11:22 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-26 9:27 [XEN PATCH v3 00/12] x86: address some violations of MISRA C Rule 16.3 Federico Serafini
2024-06-26 9:27 ` [XEN PATCH v3 01/12] automation/eclair: fix deviation " Federico Serafini
2024-06-26 9:27 ` [XEN PATCH v3 02/12] x86/cpuid: use fallthrough pseudo keyword Federico Serafini
2024-06-26 9:27 ` [XEN PATCH v3 03/12] x86/domctl: address a violation of MISRA C Rule 16.3 Federico Serafini
2024-06-26 9:27 ` [XEN PATCH v3 04/12] x86/vpmu: address violations " Federico Serafini
2024-06-27 0:50 ` Stefano Stabellini
2024-07-01 8:40 ` Jan Beulich
2024-06-26 9:27 ` [XEN PATCH v3 05/12] x86/traps: " Federico Serafini
2024-06-27 0:52 ` Stefano Stabellini
2024-07-01 8:41 ` Jan Beulich
2024-06-26 9:27 ` [XEN PATCH v3 06/12] x86/mce: " Federico Serafini
2024-06-26 9:28 ` [XEN PATCH v3 07/12] x86/hvm: " Federico Serafini
2024-06-27 0:55 ` Stefano Stabellini
2024-07-01 8:47 ` Jan Beulich
2024-07-02 7:51 ` Federico Serafini
2024-07-12 23:25 ` Stefano Stabellini
2024-07-15 17:29 ` Federico Serafini
2024-06-26 9:28 ` [XEN PATCH v3 08/12] x86/vpt: address a violation " Federico Serafini
2024-06-27 0:55 ` Stefano Stabellini
2024-07-01 8:49 ` Jan Beulich
2024-07-02 7:58 ` Federico Serafini
2024-06-26 9:28 ` [XEN PATCH v3 09/12] x86/mm: add defensive return Federico Serafini
2024-07-01 8:57 ` Jan Beulich
2024-07-09 11:21 ` Alejandro Vallejo [this message]
2024-07-09 11:40 ` Jan Beulich
2024-06-26 9:28 ` [XEN PATCH v3 10/12] x86/mpparse: address a violation of MISRA C Rule 16.3 Federico Serafini
2024-06-26 9:28 ` [XEN PATCH v3 11/12] x86/vPIC: " Federico Serafini
2024-06-26 9:28 ` [XEN PATCH v3 12/12] x86/vlapic: " Federico Serafini
2024-06-26 9:57 ` [XEN PATCH v3 00/12] x86: address some violations " 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=D2KYW63EJC2X.2BK8GEXKZW2N@cloud.com \
--to=alejandro.vallejo@cloud.com \
--cc=andrew.cooper3@citrix.com \
--cc=consulting@bugseng.com \
--cc=federico.serafini@bugseng.com \
--cc=jbeulich@suse.com \
--cc=roger.pau@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/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.