diff --git a/include/linux/container_of.h b/include/linux/container_of.h index 1f6ebf27d962..28500a62ab7e 100644 --- a/include/linux/container_of.h +++ b/include/linux/container_of.h @@ -18,7 +18,7 @@ */ #define container_of(ptr, type, member) ({ \ void *__mptr = (void *)(ptr); \ - static_assert(__same_type(*(ptr), ((type *)0)->member) || \ + static_assert(__same_type(*(ptr), typeof_member(type, member)) || \ __same_type(*(ptr), void), \ "pointer type mismatch in container_of()"); \ ((type *)(__mptr - offsetof(type, member))); })