[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen master] ubsan: Fix pointer overflow error message



commit fab51099a1cdb6bfe5127b14a5d41c246ea1a2c7
Author:     Michal Orzel <michal.orzel@xxxxxxx>
AuthorDate: Tue Nov 7 10:14:17 2023 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Tue Nov 7 10:00:11 2023 +0000

    ubsan: Fix pointer overflow error message
    
    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.orzel@xxxxxxx>
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 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 0fddacabda..a3a80fa99e 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",
               _p(base), _p(result));
 
        ubsan_epilogue(&flags);
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.