On 03/01/2021 18:47, Tamas K Lengyel wrote:
> Running Xen compiled with UBSAN produces a warning for mismatched size. It's
> benign but this patch silences the warning.
>
> Signed-off-by: Tamas K Lengyel <ta...@tklengyel.com>
> ---
>  xen/arch/x86/mm/mem_sharing.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/xen/arch/x86/mm/mem_sharing.c b/xen/arch/x86/mm/mem_sharing.c
> index c428fd16ce..6920077dbf 100644
> --- a/xen/arch/x86/mm/mem_sharing.c
> +++ b/xen/arch/x86/mm/mem_sharing.c
> @@ -1638,7 +1638,10 @@ static int fork_hap_allocation(struct domain *cd, 
> struct domain *d)
>      rc = hap_set_allocation(cd, mb << (20 - PAGE_SHIFT), &preempted);
>      paging_unlock(cd);
>  
> -    return preempted ? -ERESTART : rc;
> +    if ( preempted )
> +        rc = -ERESTART;
> +
> +    return rc;

I can't repro this at all, even with some simplified examples.

-ERESTART is int (it is an enum constant in C files), as is rc, so I
can't spot a legitimate UBSAN complaint here.

Which compiler, and/or do you have the exact complaint available?

~Andrew

Reply via email to