[Intel-wired-lan] [tnguy-net-queue:dev-queue 2/12] include/linux/build_bug.h:78:41: error: static assertion failed: "sizeof(__uapi_uuid_t) == sizeof(uuid_t) && __alignof__(__uapi_uuid_t) == __alignof__(uuid_t)"
Dan Williams
dan.j.williams at intel.com
Thu Apr 10 02:01:29 UTC 2025
[add Jason, linux-cxl]
Heads up for a new __uapi_uuid_t patch.
kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue.git dev-queue
> head: 41ab790c342f99d9eb891807b2ff00caa56804b9
> commit: a4bf8e3b34147889963e4c46d1e7916f7157b784 [2/12] fwctl/cxl: Fix uuid_t usage in uapi
> config: arm-randconfig-003-20250405 (https://download.01.org/0day-ci/archive/20250405/202504050434.Eb4vugh5-lkp@intel.com/config)
> compiler: arm-linux-gnueabi-gcc (GCC) 8.5.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250405/202504050434.Eb4vugh5-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp at intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202504050434.Eb4vugh5-lkp@intel.com/
>
> All errors (new ones prefixed by >>):
>
> In file included from include/linux/bits.h:22,
> from include/linux/ratelimit_types.h:5,
> from include/linux/ratelimit.h:5,
> from include/linux/dev_printk.h:16,
> from include/linux/device.h:15,
> from drivers/cxl/port.c:3:
> >> include/linux/build_bug.h:78:41: error: static assertion failed: "sizeof(__uapi_uuid_t) == sizeof(uuid_t) && __alignof__(__uapi_uuid_t) == __alignof__(uuid_t)"
> #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
> ^~~~~~~~~~~~~~
> include/linux/build_bug.h:77:34: note: in expansion of macro '__static_assert'
> #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
> ^~~~~~~~~~~~~~~
> include/uapi/cxl/features.h:16:1: note: in expansion of macro 'static_assert'
> static_assert(sizeof(__uapi_uuid_t) == sizeof(uuid_t) &&
> ^~~~~~~~~~~~~
It turns out that on ARM the alignment of __uapi_uuid_t is 1 and the
alignment of uuid_t is 4. However, this check is not actually concerned
with the base alignment of the type, but whether it changes the size and
alignment of a structure that contains the type. The following fixes the
warning for me. I will send out a revised patch with that tomorrow if it
looks good.
diff --git a/include/uapi/cxl/features.h b/include/uapi/cxl/features.h
index dd8874860cec..06a1ae3f3fd0 100644
--- a/include/uapi/cxl/features.h
+++ b/include/uapi/cxl/features.h
@@ -14,7 +14,8 @@ typedef unsigned char __uapi_uuid_t[16];
#ifdef __KERNEL__
#include <linux/uuid.h>
static_assert(sizeof(__uapi_uuid_t) == sizeof(uuid_t) &&
- __alignof__(__uapi_uuid_t) == __alignof__(uuid_t));
+ __alignof__(struct { __uapi_uuid_t uuid; }) ==
+ __alignof__(struct { uuid_t uuid; }));
#define __uapi_uuid_t uuid_t
#endif
More information about the Intel-wired-lan
mailing list