|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 1/6] x86/PV: adjust APPEND_CALL() to comply to Misra rule 18.2
On 9/9/26 15:59, Jan Beulich wrote:
> While casting to pointer types may be more natural there, the subtraction
> then ends up violating "Subtraction between pointers shall only be applied
> to pointers that address elements of the same array". Use long arithmetic
> instead.
>
> No functional change intended.
>
> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> ---
> Depends on "Eclair: relax long <-> function-pointer conversion deviation"
> to not introduce other violations in turn.
>
> --- a/xen/arch/x86/pv/emul-priv-op.c
> +++ b/xen/arch/x86/pv/emul-priv-op.c
> @@ -92,7 +92,8 @@ static io_emul_stub_t *io_emul_stub_setu
> #define APPEND_BUFF(b) ({ memcpy(p, b, sizeof(b)); p += sizeof(b); })
> #define APPEND_CALL(f) \
> ({ \
> - long disp = (void *)(f) - (stub_va + (p - ctxt->io_emul_stub) + 5); \
> + long disp = (long)(f) - \
> + ((long)stub_va + (p - ctxt->io_emul_stub) + 5); \
> BUG_ON((int32_t)disp != disp); \
> *p++ = 0xe8; \
> *(int32_t *)p = disp; p += 4; \
LGTM.
Reviewed-by: Dmytro Prokopchuk <dmytro_prokopchuk1@xxxxxxxx>
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |