On 07/11/2023 9:14 am, Michal Orzel wrote:
> In __ubsan_handle_pointer_overflow(), fix the condition for determining
> whether a pointer operation overflowed or underflowed. Currently, the
> function reports "underflowed" when it should be reporting "overflowed"
> and vice versa.
>
> Example of incorrect error reporting:
> void *foo = (void *)__UINTPTR_MAX__;
> foo += 1;
>
> UBSAN:
> pointer operation underflowed ffffffff to 00000000
>
> Fixes: 4e3fb2fb47d6 ("ubsan: add clang 5.0 support")
> Signed-off-by: Michal Orzel <michal.or...@amd.com>
> ---
>  xen/common/ubsan/ubsan.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/xen/common/ubsan/ubsan.c b/xen/common/ubsan/ubsan.c
> index 0fddacabda6a..a3a80fa99eec 100644
> --- a/xen/common/ubsan/ubsan.c
> +++ b/xen/common/ubsan/ubsan.c
> @@ -513,7 +513,7 @@ void __ubsan_handle_pointer_overflow(struct 
> pointer_overflow_data *data,
>       ubsan_prologue(&data->location, &flags);
>  
>       pr_err("pointer operation %s %p to %p\n",
> -            base > result ? "underflowed" : "overflowed",
> +            base > result ? "overflowed" : "underflowed",

Lovely.

Acked-by: Andrew Cooper <andrew.coop...@citrix.com>

Reply via email to