lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Mon, 13 Jul 2020 17:29:06 +0800
From:   kernel test robot <lkp@...el.com>
To:     Madhuparna Bhowmik <madhuparnabhowmik10@...il.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        "Paul E. McKenney" <paulmck@...nel.org>
Subject: [rcu:rcu/test 64/65] include/linux/kernel.h:1002:17: warning: cast
 to pointer from integer of different size

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git rcu/test
head:   e4d26431bafa60b212117ec5750833d39ce1b2aa
commit: f89bf7a94ffa9446a341fefc18153e8f9bebffbb [64/65] kvm: mmu: page_track: Fix RCU list API usage
config: x86_64-rhel (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0
reproduce (this is a W=1 build):
        git checkout f89bf7a94ffa9446a341fefc18153e8f9bebffbb
        # save the attached .config to linux build tree
        make W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

   In file included from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from include/linux/kvm_host.h:12,
                    from arch/x86/kvm/mmu/page_track.c:14:
   arch/x86/kvm/mmu/page_track.c: In function 'kvm_page_track_write':
   include/linux/rculist.h:727:30: error: expected expression before ',' token
     727 |  for (__list_check_srcu(cond),     \
         |                              ^
   arch/x86/kvm/mmu/page_track.c:232:2: note: in expansion of macro 'hlist_for_each_entry_srcu'
     232 |  hlist_for_each_entry_srcu(n, &head->track_notifier_list, node,
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/preempt.h:11,
                    from include/linux/percpu.h:6,
                    from include/linux/context_tracking_state.h:5,
                    from include/linux/hardirq.h:5,
                    from include/linux/kvm_host.h:7,
                    from arch/x86/kvm/mmu/page_track.c:14:
   include/linux/compiler.h:293:2: error: expected statement before ')' token
     293 | })
         |  ^
   include/linux/list.h:955:12: note: in definition of macro 'hlist_entry_safe'
     955 |  ({ typeof(ptr) ____ptr = (ptr); \
         |            ^~~
   include/linux/rcupdate.h:366:25: note: in expansion of macro 'READ_ONCE'
     366 |  typeof(p) ________p1 = READ_ONCE(p); \
         |                         ^~~~~~~~~
   include/linux/rculist.h:728:30: note: in expansion of macro 'rcu_dereference_raw'
     728 |       pos = hlist_entry_safe(rcu_dereference_raw(hlist_first_rcu(head)),\
         |                              ^~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/page_track.c:232:2: note: in expansion of macro 'hlist_for_each_entry_srcu'
     232 |  hlist_for_each_entry_srcu(n, &head->track_notifier_list, node,
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/rcupdate.h:367:35: error: '________p1' undeclared (first use in this function)
     367 |  ((typeof(*p) __force __kernel *)(________p1)); \
         |                                   ^~~~~~~~~~
   include/linux/list.h:955:12: note: in definition of macro 'hlist_entry_safe'
     955 |  ({ typeof(ptr) ____ptr = (ptr); \
         |            ^~~
   include/linux/rculist.h:728:30: note: in expansion of macro 'rcu_dereference_raw'
     728 |       pos = hlist_entry_safe(rcu_dereference_raw(hlist_first_rcu(head)),\
         |                              ^~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/page_track.c:232:2: note: in expansion of macro 'hlist_for_each_entry_srcu'
     232 |  hlist_for_each_entry_srcu(n, &head->track_notifier_list, node,
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/rcupdate.h:367:35: note: each undeclared identifier is reported only once for each function it appears in
     367 |  ((typeof(*p) __force __kernel *)(________p1)); \
         |                                   ^~~~~~~~~~
   include/linux/list.h:955:12: note: in definition of macro 'hlist_entry_safe'
     955 |  ({ typeof(ptr) ____ptr = (ptr); \
         |            ^~~
   include/linux/rculist.h:728:30: note: in expansion of macro 'rcu_dereference_raw'
     728 |       pos = hlist_entry_safe(rcu_dereference_raw(hlist_first_rcu(head)),\
         |                              ^~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/page_track.c:232:2: note: in expansion of macro 'hlist_for_each_entry_srcu'
     232 |  hlist_for_each_entry_srcu(n, &head->track_notifier_list, node,
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:955:27: warning: initialization of 'int' from 'struct hlist_node *' makes integer from pointer without a cast [-Wint-conversion]
     955 |  ({ typeof(ptr) ____ptr = (ptr); \
         |                           ^
   include/linux/rculist.h:728:13: note: in expansion of macro 'hlist_entry_safe'
     728 |       pos = hlist_entry_safe(rcu_dereference_raw(hlist_first_rcu(head)),\
         |             ^~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/page_track.c:232:2: note: in expansion of macro 'hlist_for_each_entry_srcu'
     232 |  hlist_for_each_entry_srcu(n, &head->track_notifier_list, node,
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from include/asm-generic/bug.h:19,
                    from arch/x86/include/asm/bug.h:92,
                    from include/linux/bug.h:5,
                    from include/linux/mmdebug.h:5,
                    from include/linux/percpu.h:5,
                    from include/linux/context_tracking_state.h:5,
                    from include/linux/hardirq.h:5,
                    from include/linux/kvm_host.h:7,
                    from arch/x86/kvm/mmu/page_track.c:14:
>> include/linux/kernel.h:1002:17: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
    1002 |  void *__mptr = (void *)(ptr);     \
         |                 ^
   include/linux/list.h:945:40: note: in expansion of macro 'container_of'
     945 | #define hlist_entry(ptr, type, member) container_of(ptr,type,member)
         |                                        ^~~~~~~~~~~~
   include/linux/list.h:956:15: note: in expansion of macro 'hlist_entry'
     956 |     ____ptr ? hlist_entry(____ptr, type, member) : NULL; \
         |               ^~~~~~~~~~~
   include/linux/rculist.h:728:13: note: in expansion of macro 'hlist_entry_safe'
     728 |       pos = hlist_entry_safe(rcu_dereference_raw(hlist_first_rcu(head)),\
         |             ^~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/page_track.c:232:2: note: in expansion of macro 'hlist_for_each_entry_srcu'
     232 |  hlist_for_each_entry_srcu(n, &head->track_notifier_list, node,
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from include/asm-generic/bug.h:5,
                    from arch/x86/include/asm/bug.h:92,
                    from include/linux/bug.h:5,
                    from include/linux/mmdebug.h:5,
                    from include/linux/percpu.h:5,
                    from include/linux/context_tracking_state.h:5,
                    from include/linux/hardirq.h:5,
                    from include/linux/kvm_host.h:7,
                    from arch/x86/kvm/mmu/page_track.c:14:
   include/linux/kernel.h:1003:32: error: invalid type argument of unary '*' (have 'int')
    1003 |  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
         |                                ^~~~~~
   include/linux/compiler.h:372:9: note: in definition of macro '__compiletime_assert'
     372 |   if (!(condition))     \
         |         ^~~~~~~~~
   include/linux/compiler.h:392:2: note: in expansion of macro '_compiletime_assert'
     392 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |  ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:1003:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
    1003 |  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
         |  ^~~~~~~~~~~~~~~~
   include/linux/kernel.h:1003:20: note: in expansion of macro '__same_type'
    1003 |  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
         |                    ^~~~~~~~~~~
   include/linux/list.h:945:40: note: in expansion of macro 'container_of'
     945 | #define hlist_entry(ptr, type, member) container_of(ptr,type,member)
         |                                        ^~~~~~~~~~~~
   include/linux/list.h:956:15: note: in expansion of macro 'hlist_entry'
     956 |     ____ptr ? hlist_entry(____ptr, type, member) : NULL; \
         |               ^~~~~~~~~~~
   include/linux/rculist.h:728:13: note: in expansion of macro 'hlist_entry_safe'
     728 |       pos = hlist_entry_safe(rcu_dereference_raw(hlist_first_rcu(head)),\
         |             ^~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/page_track.c:232:2: note: in expansion of macro 'hlist_for_each_entry_srcu'
     232 |  hlist_for_each_entry_srcu(n, &head->track_notifier_list, node,
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:1004:18: error: invalid type argument of unary '*' (have 'int')
    1004 |     !__same_type(*(ptr), void),   \
         |                  ^~~~~~
   include/linux/compiler.h:372:9: note: in definition of macro '__compiletime_assert'
     372 |   if (!(condition))     \
         |         ^~~~~~~~~
   include/linux/compiler.h:392:2: note: in expansion of macro '_compiletime_assert'
     392 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |  ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:1003:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
    1003 |  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
         |  ^~~~~~~~~~~~~~~~
   include/linux/kernel.h:1004:6: note: in expansion of macro '__same_type'
    1004 |     !__same_type(*(ptr), void),   \
         |      ^~~~~~~~~~~
   include/linux/list.h:945:40: note: in expansion of macro 'container_of'
     945 | #define hlist_entry(ptr, type, member) container_of(ptr,type,member)
         |                                        ^~~~~~~~~~~~
   include/linux/list.h:956:15: note: in expansion of macro 'hlist_entry'
     956 |     ____ptr ? hlist_entry(____ptr, type, member) : NULL; \
         |               ^~~~~~~~~~~
   include/linux/rculist.h:728:13: note: in expansion of macro 'hlist_entry_safe'
     728 |       pos = hlist_entry_safe(rcu_dereference_raw(hlist_first_rcu(head)),\
         |             ^~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/page_track.c:232:2: note: in expansion of macro 'hlist_for_each_entry_srcu'
     232 |  hlist_for_each_entry_srcu(n, &head->track_notifier_list, node,
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from include/linux/kvm_host.h:12,
                    from arch/x86/kvm/mmu/page_track.c:14:
   include/linux/rculist.h:727:30: warning: left-hand operand of comma expression has no effect [-Wunused-value]
     727 |  for (__list_check_srcu(cond),     \
         |                              ^
   arch/x86/kvm/mmu/page_track.c:232:2: note: in expansion of macro 'hlist_for_each_entry_srcu'
     232 |  hlist_for_each_entry_srcu(n, &head->track_notifier_list, node,
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/page_track.c: In function 'kvm_page_track_flush_slot':
   include/linux/rculist.h:727:30: error: expected expression before ',' token
     727 |  for (__list_check_srcu(cond),     \
         |                              ^
   arch/x86/kvm/mmu/page_track.c:258:2: note: in expansion of macro 'hlist_for_each_entry_srcu'
     258 |  hlist_for_each_entry_srcu(n, &head->track_notifier_list, node,
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/preempt.h:11,
                    from include/linux/percpu.h:6,
                    from include/linux/context_tracking_state.h:5,
                    from include/linux/hardirq.h:5,
                    from include/linux/kvm_host.h:7,
                    from arch/x86/kvm/mmu/page_track.c:14:
   include/linux/compiler.h:293:2: error: expected statement before ')' token
     293 | })
         |  ^
   include/linux/list.h:955:12: note: in definition of macro 'hlist_entry_safe'
     955 |  ({ typeof(ptr) ____ptr = (ptr); \
         |            ^~~
   include/linux/rcupdate.h:366:25: note: in expansion of macro 'READ_ONCE'
     366 |  typeof(p) ________p1 = READ_ONCE(p); \
         |                         ^~~~~~~~~
   include/linux/rculist.h:728:30: note: in expansion of macro 'rcu_dereference_raw'
     728 |       pos = hlist_entry_safe(rcu_dereference_raw(hlist_first_rcu(head)),\
         |                              ^~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/page_track.c:258:2: note: in expansion of macro 'hlist_for_each_entry_srcu'
     258 |  hlist_for_each_entry_srcu(n, &head->track_notifier_list, node,
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/rcupdate.h:367:35: error: '________p1' undeclared (first use in this function)
     367 |  ((typeof(*p) __force __kernel *)(________p1)); \
         |                                   ^~~~~~~~~~
   include/linux/list.h:955:12: note: in definition of macro 'hlist_entry_safe'
     955 |  ({ typeof(ptr) ____ptr = (ptr); \
         |            ^~~
   include/linux/rculist.h:728:30: note: in expansion of macro 'rcu_dereference_raw'
     728 |       pos = hlist_entry_safe(rcu_dereference_raw(hlist_first_rcu(head)),\
         |                              ^~~~~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/page_track.c:258:2: note: in expansion of macro 'hlist_for_each_entry_srcu'
     258 |  hlist_for_each_entry_srcu(n, &head->track_notifier_list, node,
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:955:27: warning: initialization of 'int' from 'struct hlist_node *' makes integer from pointer without a cast [-Wint-conversion]
     955 |  ({ typeof(ptr) ____ptr = (ptr); \
         |                           ^
   include/linux/rculist.h:728:13: note: in expansion of macro 'hlist_entry_safe'
     728 |       pos = hlist_entry_safe(rcu_dereference_raw(hlist_first_rcu(head)),\
         |             ^~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/page_track.c:258:2: note: in expansion of macro 'hlist_for_each_entry_srcu'
     258 |  hlist_for_each_entry_srcu(n, &head->track_notifier_list, node,
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from include/asm-generic/bug.h:19,
                    from arch/x86/include/asm/bug.h:92,
                    from include/linux/bug.h:5,
                    from include/linux/mmdebug.h:5,
                    from include/linux/percpu.h:5,
                    from include/linux/context_tracking_state.h:5,
                    from include/linux/hardirq.h:5,
                    from include/linux/kvm_host.h:7,
                    from arch/x86/kvm/mmu/page_track.c:14:
>> include/linux/kernel.h:1002:17: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
    1002 |  void *__mptr = (void *)(ptr);     \
         |                 ^
   include/linux/list.h:945:40: note: in expansion of macro 'container_of'
     945 | #define hlist_entry(ptr, type, member) container_of(ptr,type,member)
         |                                        ^~~~~~~~~~~~
   include/linux/list.h:956:15: note: in expansion of macro 'hlist_entry'
     956 |     ____ptr ? hlist_entry(____ptr, type, member) : NULL; \
         |               ^~~~~~~~~~~
   include/linux/rculist.h:728:13: note: in expansion of macro 'hlist_entry_safe'
     728 |       pos = hlist_entry_safe(rcu_dereference_raw(hlist_first_rcu(head)),\
         |             ^~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/page_track.c:258:2: note: in expansion of macro 'hlist_for_each_entry_srcu'
     258 |  hlist_for_each_entry_srcu(n, &head->track_notifier_list, node,
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from include/asm-generic/bug.h:5,
                    from arch/x86/include/asm/bug.h:92,
                    from include/linux/bug.h:5,
                    from include/linux/mmdebug.h:5,
                    from include/linux/percpu.h:5,
                    from include/linux/context_tracking_state.h:5,
                    from include/linux/hardirq.h:5,
                    from include/linux/kvm_host.h:7,
                    from arch/x86/kvm/mmu/page_track.c:14:
   include/linux/kernel.h:1003:32: error: invalid type argument of unary '*' (have 'int')
    1003 |  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
         |                                ^~~~~~
   include/linux/compiler.h:372:9: note: in definition of macro '__compiletime_assert'
     372 |   if (!(condition))     \
         |         ^~~~~~~~~
   include/linux/compiler.h:392:2: note: in expansion of macro '_compiletime_assert'
     392 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |  ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:1003:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
    1003 |  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
         |  ^~~~~~~~~~~~~~~~
   include/linux/kernel.h:1003:20: note: in expansion of macro '__same_type'
    1003 |  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
         |                    ^~~~~~~~~~~
   include/linux/list.h:945:40: note: in expansion of macro 'container_of'
     945 | #define hlist_entry(ptr, type, member) container_of(ptr,type,member)
         |                                        ^~~~~~~~~~~~
   include/linux/list.h:956:15: note: in expansion of macro 'hlist_entry'
     956 |     ____ptr ? hlist_entry(____ptr, type, member) : NULL; \
         |               ^~~~~~~~~~~
   include/linux/rculist.h:728:13: note: in expansion of macro 'hlist_entry_safe'
     728 |       pos = hlist_entry_safe(rcu_dereference_raw(hlist_first_rcu(head)),\
         |             ^~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/page_track.c:258:2: note: in expansion of macro 'hlist_for_each_entry_srcu'
     258 |  hlist_for_each_entry_srcu(n, &head->track_notifier_list, node,
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:1004:18: error: invalid type argument of unary '*' (have 'int')
    1004 |     !__same_type(*(ptr), void),   \
         |                  ^~~~~~
   include/linux/compiler.h:372:9: note: in definition of macro '__compiletime_assert'
     372 |   if (!(condition))     \
         |         ^~~~~~~~~
   include/linux/compiler.h:392:2: note: in expansion of macro '_compiletime_assert'
     392 |  _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
         |  ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:1003:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
    1003 |  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
         |  ^~~~~~~~~~~~~~~~
   include/linux/kernel.h:1004:6: note: in expansion of macro '__same_type'
    1004 |     !__same_type(*(ptr), void),   \
         |      ^~~~~~~~~~~
   include/linux/list.h:945:40: note: in expansion of macro 'container_of'
     945 | #define hlist_entry(ptr, type, member) container_of(ptr,type,member)
         |                                        ^~~~~~~~~~~~
   include/linux/list.h:956:15: note: in expansion of macro 'hlist_entry'
     956 |     ____ptr ? hlist_entry(____ptr, type, member) : NULL; \
         |               ^~~~~~~~~~~
   include/linux/rculist.h:728:13: note: in expansion of macro 'hlist_entry_safe'
     728 |       pos = hlist_entry_safe(rcu_dereference_raw(hlist_first_rcu(head)),\
         |             ^~~~~~~~~~~~~~~~
   arch/x86/kvm/mmu/page_track.c:258:2: note: in expansion of macro 'hlist_for_each_entry_srcu'
     258 |  hlist_for_each_entry_srcu(n, &head->track_notifier_list, node,
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/pid.h:5,
                    from include/linux/sched.h:14,
                    from include/linux/kvm_host.h:12,
                    from arch/x86/kvm/mmu/page_track.c:14:
   include/linux/rculist.h:727:30: warning: left-hand operand of comma expression has no effect [-Wunused-value]
     727 |  for (__list_check_srcu(cond),     \
         |                              ^
   arch/x86/kvm/mmu/page_track.c:258:2: note: in expansion of macro 'hlist_for_each_entry_srcu'
     258 |  hlist_for_each_entry_srcu(n, &head->track_notifier_list, node,
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~

vim +1002 include/linux/kernel.h

cf14f27f82af78 Alexei Starovoitov 2018-03-28   993  
^1da177e4c3f41 Linus Torvalds     2005-04-16   994  /**
^1da177e4c3f41 Linus Torvalds     2005-04-16   995   * container_of - cast a member of a structure out to the containing structure
^1da177e4c3f41 Linus Torvalds     2005-04-16   996   * @ptr:	the pointer to the member.
^1da177e4c3f41 Linus Torvalds     2005-04-16   997   * @type:	the type of the container struct this is embedded in.
^1da177e4c3f41 Linus Torvalds     2005-04-16   998   * @member:	the name of the member within the struct.
^1da177e4c3f41 Linus Torvalds     2005-04-16   999   *
^1da177e4c3f41 Linus Torvalds     2005-04-16  1000   */
^1da177e4c3f41 Linus Torvalds     2005-04-16  1001  #define container_of(ptr, type, member) ({				\
c7acec713d14c6 Ian Abbott         2017-07-12 @1002  	void *__mptr = (void *)(ptr);					\
c7acec713d14c6 Ian Abbott         2017-07-12  1003  	BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&	\
c7acec713d14c6 Ian Abbott         2017-07-12  1004  			 !__same_type(*(ptr), void),			\
c7acec713d14c6 Ian Abbott         2017-07-12  1005  			 "pointer type mismatch in container_of()");	\
c7acec713d14c6 Ian Abbott         2017-07-12  1006  	((type *)(__mptr - offsetof(type, member))); })
^1da177e4c3f41 Linus Torvalds     2005-04-16  1007  

:::::: The code at line 1002 was first introduced by commit
:::::: c7acec713d14c6ce8a20154f9dfda258d6bcad3b kernel.h: handle pointers to arrays better in container_of()

:::::: TO: Ian Abbott <abbotti@....co.uk>
:::::: CC: Linus Torvalds <torvalds@...ux-foundation.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (45516 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ