]> xenbits.xensource.com Git - xen.git/commitdiff
xen/ubsan: Fix UB in type_descriptor declaration
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 26 Jun 2024 12:12:38 +0000 (14:12 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 26 Jun 2024 12:12:38 +0000 (14:12 +0200)
struct type_descriptor is arranged with a NUL terminated string following the
kind/info fields.

The only reason this doesn't trip UBSAN detection itself (on more modern
compilers at least) is because struct type_descriptor is only referenced in
suppressed regions.

Switch the declaration to be a real flexible member.  No functional change.

Fixes: 00fcf4dd8eb4 ("xen/ubsan: Import ubsan implementation from Linux 4.13")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
master commit: bd59af99700f075d06a6d47a16f777c9519928e0
master date: 2024-06-18 14:55:04 +0100

xen/common/ubsan/ubsan.h

index a3159040fefbdf7ba3d6bc794c8ee172a8ab83aa..3db42e75b13852c984a16c07d33b3834866cf5ee 100644 (file)
@@ -10,7 +10,7 @@ enum {
 struct type_descriptor {
        u16 type_kind;
        u16 type_info;
-       char type_name[1];
+       char type_name[];
 };
 
 struct source_location {