From: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Federico Serafini <federico.serafini@bugseng.com>,
consulting@bugseng.com,
"Daniel P. Smith" <dpsmith@apertussolutions.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
xen-devel@lists.xenproject.org
Subject: Re: [XEN PATCH 1/3] EFI: address violations of MISRA C Rule 13.6
Date: Wed, 11 Sep 2024 15:16:40 +0200 [thread overview]
Message-ID: <ZuGYOldX55_ZfJCv@mail-itl> (raw)
In-Reply-To: <c068874b-a4bd-4ccc-a9bf-08a996797543@suse.com>
[-- Attachment #1: Type: text/plain, Size: 1699 bytes --]
On Wed, Sep 11, 2024 at 02:50:03PM +0200, Jan Beulich wrote:
> On 10.09.2024 21:06, Federico Serafini wrote:
> > Refactor the code to improve readability
>
> I question this aspect. I'm not the maintainer of this code anymore, so
> my view probably doesn't matter much here.
>
> > and address violations of
> > MISRA C:2012 Rule 13.6 ("The operand of the `sizeof' operator shall
> > not contain any expression which has potential side effect").
>
> Where's the potential side effect? Since you move ...
>
> > --- a/xen/common/efi/runtime.c
> > +++ b/xen/common/efi/runtime.c
> > @@ -250,14 +250,20 @@ int efi_get_info(uint32_t idx, union xenpf_efi_info *info)
> > info->cfg.addr = __pa(efi_ct);
> > info->cfg.nent = efi_num_ct;
> > break;
> > +
> > case XEN_FW_EFI_VENDOR:
> > + {
> > + XEN_GUEST_HANDLE_PARAM(CHAR16) vendor_name =
> > + guest_handle_cast(info->vendor.name, CHAR16);
>
> .. this out, it must be the one. I've looked at it, yet I can't spot
> anything:
>
> #define guest_handle_cast(hnd, type) ({ \
> type *_x = (hnd).p; \
> (XEN_GUEST_HANDLE_PARAM(type)) { _x }; \
> })
>
> As a rule of thumb, when things aren't obvious, please call out the
> specific aspect / property in descriptions of such patches.
I guess it's because guest_handle_cast() is a macro, yet it's lowercase
so looks like a function? Wasn't there some other MISRA rule about
lowercase/uppercase for macro names?
And yes, I don't really see why this would violate the side effect rule
either.
--
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2024-09-11 13:17 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-10 19:05 [XEN PATCH 0/3] xen: address violations of MISRA C Rule 13.6 Federico Serafini
2024-09-10 19:06 ` [XEN PATCH 1/3] EFI: " Federico Serafini
2024-09-11 12:50 ` Jan Beulich
2024-09-11 13:16 ` Marek Marczykowski-Górecki [this message]
2024-09-11 14:10 ` Jan Beulich
2024-09-11 14:27 ` Andrew Cooper
2024-09-11 14:56 ` Jan Beulich
2024-09-11 14:27 ` Nicola Vetrini
2024-09-11 14:57 ` Jan Beulich
2024-09-12 8:06 ` Federico Serafini
2024-09-10 19:06 ` [XEN PATCH 2/3] xen/gnttab: " Federico Serafini
2024-09-11 12:53 ` Jan Beulich
2024-09-12 0:23 ` Stefano Stabellini
2024-09-10 19:06 ` [XEN PATCH 3/3] automation/eclair: tag Rule 13.6 as clean Federico Serafini
2024-09-12 0:17 ` Stefano Stabellini
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=ZuGYOldX55_ZfJCv@mail-itl \
--to=marmarek@invisiblethingslab.com \
--cc=andrew.cooper3@citrix.com \
--cc=consulting@bugseng.com \
--cc=dpsmith@apertussolutions.com \
--cc=federico.serafini@bugseng.com \
--cc=jbeulich@suse.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.