|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [XEN PATCH 2/4] x86/hvm: address violations of MISRA C Rule 20.7
On 2024-05-16 01:18, Stefano Stabellini wrote: On Wed, 15 May 2024, Nicola Vetrini wrote:MISRA C Rule 20.7 states: "Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses". Therefore, somemacro definitions should gain additional parentheses to ensure that allcurrent and future users will be safe with respect to expansions that can possibly alter the semantics of the passed-in macro parameter. No functional change. Signed-off-by: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>--- xen/arch/x86/hvm/mtrr.c | 2 +- xen/arch/x86/hvm/rtc.c | 2 +- xen/arch/x86/include/asm/hvm/save.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/hvm/mtrr.c b/xen/arch/x86/hvm/mtrr.c index 32f74c1db03b..1079851f70ed 100644 --- a/xen/arch/x86/hvm/mtrr.c +++ b/xen/arch/x86/hvm/mtrr.c @@ -16,7 +16,7 @@ #include <public/hvm/e820.h> /* Get page attribute fields (PAn) from PAT MSR. */-#define pat_cr_2_paf(pat_cr,n) ((((uint64_t)pat_cr) >> ((n)<<3)) & 0xff) +#define pat_cr_2_paf(pat_cr, n) ((((uint64_t)(pat_cr)) >> ((n) << 3)) & 0xff)just a cosmetic change No. The point here is that pat_cr could in principle be something like 1 + 2, which without parentheses may not expand as intended (in this case because of the nearby cast). Then there's also the style fix on n
-- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |