[PATCH v2 1/2] ubsan: use linux-compat.h

Jan Beulich posted 2 patches 1 year, 1 month ago
[PATCH v2 1/2] ubsan: use linux-compat.h
Posted by Jan Beulich 1 year, 1 month ago
Instead of replacing the s64 (and later also u64) uses, keep the file as
little modified as possible from its Linux origin. (Sadly the two cast
adjustments are needed to avoid compiler warnings.)

Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
v2: New.

--- a/xen/common/ubsan/ubsan.c
+++ b/xen/common/ubsan/ubsan.c
@@ -20,8 +20,6 @@ static DEFINE_PER_CPU(struct xen_ubsan[1
 #undef current
 #define current this_cpu(in_ubsan)
 #define dump_stack dump_execution_state
-#define u64 long long unsigned int
-#define s64 long long int
 
 #include "ubsan.h"
 
@@ -141,10 +139,11 @@ static void val_to_string(char *str, siz
 #endif
 		} else if (type_is_signed(type)) {
 			scnprintf(str, size, "%lld",
-				(s64)get_signed_val(type, value));
+				  (long long)get_signed_val(type, value));
 		} else {
 			scnprintf(str, size, "%llu",
-				(u64)get_unsigned_val(type, value));
+				  (unsigned long long)get_unsigned_val(type,
+								       value));
 		}
 	}
 }
--- a/xen/common/ubsan/ubsan.h
+++ b/xen/common/ubsan/ubsan.h
@@ -1,6 +1,8 @@
 #ifndef _LIB_UBSAN_H
 #define _LIB_UBSAN_H
 
+#include <xen/linux-compat.h>
+
 enum {
 	type_kind_int = 0,
 	type_kind_float = 1,
Re: [PATCH v2 1/2] ubsan: use linux-compat.h
Posted by Andrew Cooper 1 year, 1 month ago
On 12/09/2024 1:19 pm, Jan Beulich wrote:
> Instead of replacing the s64 (and later also u64) uses, keep the file as
> little modified as possible from its Linux origin. (Sadly the two cast
> adjustments are needed to avoid compiler warnings.)
>
> Requested-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

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