[gustavoars:testing/WFAMNAE-next20240223 1/1] drivers/rpmsg/qcom_glink_native.c:832:7: error: static assertion failed due to requirement '__builtin_types_compatible_p(struct glink_msg, struct glink_msg_hdr) || __builtin_types_compatible_p(struct glink_msg, void)': pointer type mismatch in container_o...

From: kernel test robot
Date: Sun Feb 25 2024 - 07:07:38 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git testing/WFAMNAE-next20240223
head: b23fc9e6ff31f4ef9e8de5580963cf53579ef0d4
commit: b23fc9e6ff31f4ef9e8de5580963cf53579ef0d4 [1/1] treewide: Address -Wflexible-array-member-not-at-end warnings
config: arm-randconfig-003-20240225 (https://download.01.org/0day-ci/archive/20240225/202402252045.eiZZhW0P-lkp@xxxxxxxxx/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project edd4aee4dd9b5b98b2576a6f783e4086173d902a)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240225/202402252045.eiZZhW0P-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202402252045.eiZZhW0P-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

>> drivers/rpmsg/qcom_glink_native.c:832:7: error: static assertion failed due to requirement '__builtin_types_compatible_p(struct glink_msg, struct glink_msg_hdr) || __builtin_types_compatible_p(struct glink_msg, void)': pointer type mismatch in container_of()
832 | container_of(&dcmd->msg, struct glink_msg, hdr), 0,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/container_of.h:20:16: note: expanded from macro 'container_of'
20 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21 | __same_type(*(ptr), void), \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22 | "pointer type mismatch in container_of()"); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:390:27: note: expanded from macro '__same_type'
390 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
| ^
include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
| ^~~~
drivers/rpmsg/qcom_glink_native.c:1692:9: error: static assertion failed due to requirement '__builtin_types_compatible_p(struct glink_msg, struct glink_msg_hdr) || __builtin_types_compatible_p(struct glink_msg, void)': pointer type mismatch in container_of()
1692 | msg = container_of(&dcmd->msg, struct glink_msg, hdr);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/container_of.h:20:16: note: expanded from macro 'container_of'
20 | static_assert(__same_type(*(ptr), ((type *)0)->member) || \
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21 | __same_type(*(ptr), void), \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22 | "pointer type mismatch in container_of()"); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:390:27: note: expanded from macro '__same_type'
390 | #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
| ^
include/linux/build_bug.h:77:50: note: expanded from macro 'static_assert'
77 | #define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:78:56: note: expanded from macro '__static_assert'
78 | #define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
| ^~~~
2 errors generated.


vim +832 drivers/rpmsg/qcom_glink_native.c

813
814 static int qcom_glink_rx_defer(struct qcom_glink *glink, size_t extra)
815 {
816 struct glink_defer_cmd *dcmd;
817
818 extra = ALIGN(extra, 8);
819
820 if (qcom_glink_rx_avail(glink) < sizeof(struct glink_msg) + extra) {
821 dev_dbg(glink->dev, "Insufficient data in rx fifo");
822 return -ENXIO;
823 }
824
825 dcmd = kzalloc(struct_size(dcmd, data, extra), GFP_ATOMIC);
826 if (!dcmd)
827 return -ENOMEM;
828
829 INIT_LIST_HEAD(&dcmd->node);
830
831 qcom_glink_rx_peek(glink,
> 832 container_of(&dcmd->msg, struct glink_msg, hdr), 0,
833 sizeof(dcmd->msg) + extra);
834
835 spin_lock(&glink->rx_lock);
836 list_add_tail(&dcmd->node, &glink->rx_queue);
837 spin_unlock(&glink->rx_lock);
838
839 schedule_work(&glink->rx_work);
840 qcom_glink_rx_advance(glink, sizeof(dcmd->msg) + extra);
841
842 return 0;
843 }
844

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki