|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 3/5] x86/shadow: conditionalize / rename local variables
On Wed, May 13, 2026 at 01:45:12PM +0200, Jan Beulich wrote:
> ... shadowing a function scope one in one case and the global _end[] in
> another, thus violating Misra C:2012 rule 5.3 ("An identifier declared in
> an inner scope shall not hide an identifier declared in an outer scope").
> No difference in generated code.
>
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
>
> --- a/xen/arch/x86/mm/shadow/multi.c
> +++ b/xen/arch/x86/mm/shadow/multi.c
> @@ -857,13 +857,13 @@ do {
> /* 64-bit l2: touch all entries except for PAE compat guests. */
> #define FOREACH_PRESENT_L2E(_sl2mfn, _sl2e, _gl2p, _done, _dom, _code) \
> do { \
> - unsigned int _i, _end = SHADOW_L2_PAGETABLE_ENTRIES; \
> + unsigned int _i, _nr = SHADOW_L2_PAGETABLE_ENTRIES; \
> shadow_l2e_t *_sp = map_domain_page((_sl2mfn)); \
> ASSERT_VALID_L2(mfn_to_page(_sl2mfn)->u.sh.type); \
> if ( is_pv_32bit_domain(_dom) /* implies !paging_mode_external */ && \
> mfn_to_page(_sl2mfn)->u.sh.type != SH_type_l2_64_shadow ) \
> - _end = COMPAT_L2_PAGETABLE_FIRST_XEN_SLOT(_dom); \
> - for ( _i = 0; _i < _end; ++_i ) \
> + _nr = COMPAT_L2_PAGETABLE_FIRST_XEN_SLOT(_dom); \
> + for ( _i = 0; _i < _nr; ++_i ) \
> { \
> (_sl2e) = _sp + _i; \
> if ( shadow_l2e_get_flags(*(_sl2e)) & _PAGE_PRESENT ) \
> @@ -3349,7 +3349,9 @@ static pagetable_t cf_check sh_update_cr
> #if SHADOW_PAGING_LEVELS == 3
> {
> mfn_t smfn =
> pagetable_get_mfn(v->arch.paging.shadow.shadow_table[0]);
> +#if GUEST_PAGING_LEVELS != 3
> unsigned int i;
> +#endif
Hm, that one is nasty, we would better use a different variable name,
but that would be more churn.
Thanks, Roger.
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |