[PATCH 1/4] x8&/mm: fix IS_LnE_ALIGNED() to comply with Misra Rule 20.7

Roger Pau Monne posted 4 patches 1 month, 1 week ago
[PATCH 1/4] x8&/mm: fix IS_LnE_ALIGNED() to comply with Misra Rule 20.7
Posted by Roger Pau Monne 1 month, 1 week ago
While not strictly needed to guarantee operator precedence is as expected, add
the parentheses to comply with Misra Rule 20.7.

No functional change intended.

Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
Fixes: 5b52e1b0436f ('x86/mm: skip super-page alignment checks for non-present entries')
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 494c14e80ff9..fa21903eb25a 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5498,7 +5498,7 @@ int map_pages_to_xen(
  * be INVALID_MFN, since alignment is only relevant for present entries.
  */
 #define IS_LnE_ALIGNED(v, m, n) ({                              \
-    mfn_t m_ = m;                                               \
+    mfn_t m_ = (m);                                             \
                                                                 \
     ASSERT(!mfn_eq(m_, INVALID_MFN));                           \
     IS_ALIGNED(PFN_DOWN(v) | mfn_x(m_),                         \
-- 
2.46.0


Re: [PATCH 1/4] x8&/mm: fix IS_LnE_ALIGNED() to comply with Misra Rule 20.7
Posted by Jan Beulich 1 month, 1 week ago
On 19.11.2024 11:34, Roger Pau Monne wrote:
> While not strictly needed to guarantee operator precedence is as expected, add
> the parentheses to comply with Misra Rule 20.7.
> 
> No functional change intended.
> 
> Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Fixes: 5b52e1b0436f ('x86/mm: skip super-page alignment checks for non-present entries')
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

Acked-by: Jan Beulich <jbeulich@suse.com>



Re: [PATCH 1/4] x8&/mm: fix IS_LnE_ALIGNED() to comply with Misra Rule 20.7
Posted by Frediano Ziglio 1 month, 1 week ago
On Tue, Nov 19, 2024 at 10:35 AM Roger Pau Monne <roger.pau@citrix.com> wrote:
>
> While not strictly needed to guarantee operator precedence is as expected, add
> the parentheses to comply with Misra Rule 20.7.
>
> No functional change intended.
>
> Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Fixes: 5b52e1b0436f ('x86/mm: skip super-page alignment checks for non-present entries')
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> ---
>  xen/arch/x86/mm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
> index 494c14e80ff9..fa21903eb25a 100644
> --- a/xen/arch/x86/mm.c
> +++ b/xen/arch/x86/mm.c
> @@ -5498,7 +5498,7 @@ int map_pages_to_xen(
>   * be INVALID_MFN, since alignment is only relevant for present entries.
>   */
>  #define IS_LnE_ALIGNED(v, m, n) ({                              \
> -    mfn_t m_ = m;                                               \
> +    mfn_t m_ = (m);                                             \
>                                                                  \
>      ASSERT(!mfn_eq(m_, INVALID_MFN));                           \
>      IS_ALIGNED(PFN_DOWN(v) | mfn_x(m_),                         \

Minor, typo in subject: x8& -> x86

Frediano
Re: [PATCH 1/4] x8&/mm: fix IS_LnE_ALIGNED() to comply with Misra Rule 20.7
Posted by Roger Pau Monné 1 month, 1 week ago
On Tue, Nov 19, 2024 at 10:52:26AM +0000, Frediano Ziglio wrote:
> On Tue, Nov 19, 2024 at 10:35 AM Roger Pau Monne <roger.pau@citrix.com> wrote:
> >
> > While not strictly needed to guarantee operator precedence is as expected, add
> > the parentheses to comply with Misra Rule 20.7.
> >
> > No functional change intended.
> >
> > Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
> > Fixes: 5b52e1b0436f ('x86/mm: skip super-page alignment checks for non-present entries')
> > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> > ---
> >  xen/arch/x86/mm.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
> > index 494c14e80ff9..fa21903eb25a 100644
> > --- a/xen/arch/x86/mm.c
> > +++ b/xen/arch/x86/mm.c
> > @@ -5498,7 +5498,7 @@ int map_pages_to_xen(
> >   * be INVALID_MFN, since alignment is only relevant for present entries.
> >   */
> >  #define IS_LnE_ALIGNED(v, m, n) ({                              \
> > -    mfn_t m_ = m;                                               \
> > +    mfn_t m_ = (m);                                             \
> >                                                                  \
> >      ASSERT(!mfn_eq(m_, INVALID_MFN));                           \
> >      IS_ALIGNED(PFN_DOWN(v) | mfn_x(m_),                         \
> 
> Minor, typo in subject: x8& -> x86

Nice, that's what you get when you press shift + 6 on a Spanish
keyboard.  Hope it can be adjusted at commit.

Thanks.