:::::: :::::: Manual check reason: "low confidence bisect report" :::::: Manual check reason: "low confidence static check warning: include/linux/container_of.h:18:15: warning: use of uninitialized value '((struct hidma_desc *)((char *)__mptr + 28))[71582787].node.next' [CWE-457] [-Wanalyzer-use-of-uninitialized-value]" ::::::
BCC: l...@intel.com CC: kbuild-...@lists.01.org CC: linux-ker...@vger.kernel.org TO: Andy Shevchenko <andriy.shevche...@linux.intel.com> CC: Andrew Morton <a...@linux-foundation.org> CC: Linux Memory Management List <linux...@kvack.org> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 4a9350597aff50bbd0f4b80ccf49d2e02d1111f5 commit: d2a8ebbf8192b84b11f1b204c4f7c602df32aeac kernel.h: split out container_of() and typeof_member() macros date: 9 months ago :::::: branch date: 8 hours ago :::::: commit date: 9 months ago config: arm-randconfig-c002-20220811 (https://download.01.org/0day-ci/archive/20220813/202208130859.iuqabbx8-...@intel.com/config) compiler: arm-linux-gnueabi-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d2a8ebbf8192b84b11f1b204c4f7c602df32aeac git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout d2a8ebbf8192b84b11f1b204c4f7c602df32aeac # save the config file COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross ARCH=arm KBUILD_USERCFLAGS='-fanalyzer -Wno-error' If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot <l...@intel.com> gcc-analyzer warnings: (new ones prefixed by >>) | | 459 | static int hidma_terminate_channel(struct dma_chan *chan) | | ^~~~~~~~~~~~~~~~~~~~~~~ | | | | | (3) entry to 'hidma_terminate_channel' |...... | 470 | hidma_process_completed(mchan); | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (4) calling 'hidma_process_completed' from 'hidma_terminate_channel' | +--> 'hidma_process_completed': events 5-6 | | 108 | static void hidma_process_completed(struct hidma_chan *mchan) | | ^~~~~~~~~~~~~~~~~~~~~~~ | | | | | (5) entry to 'hidma_process_completed' |...... | 117 | struct list_head list; | | ~~~~ | | | | | (6) region created on stack here | 'hidma_process_completed': event 7 | |include/linux/list.h:498:12: | 498 | if (!list_empty(list)) { | | ^ | | | | | (7) following 'false' branch... | 'hidma_process_completed': event 8 | |include/linux/spinlock.h:293:17: | 293 | _raw_spin_unlock_irqrestore(lock, flags); \ | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (8) ...to here include/linux/spinlock.h:417:9: note: in expansion of macro 'raw_spin_unlock_irqrestore' | 417 | raw_spin_unlock_irqrestore(&lock->rlock, flags); | | ^~~~~~~~~~~~~~~~~~~~~~~~~~ | 'hidma_process_completed': event 9 | |include/linux/list.h:717:14: | 717 | !list_entry_is_head(pos, head, member); \ | | ^ | | | | | (9) following 'true' branch... drivers/dma/qcom/hidma.c:127:9: note: in expansion of macro 'list_for_each_entry_safe' | 127 | list_for_each_entry_safe(mdesc, next, &list, node) { | | ^~~~~~~~~~~~~~~~~~~~~~~~ | 'hidma_process_completed': events 10-11 | | 129 | struct dmaengine_desc_callback cb; | | ^~ | | | | | (10) ...to here |...... | 145 | dma_cookie_complete(desc); | | ~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (11) calling 'dma_cookie_complete' from 'hidma_process_completed' | +--> 'dma_cookie_complete': event 12 | |drivers/dma/qcom/../dmaengine.h:52:20: | 52 | static inline void dma_cookie_complete(struct dma_async_tx_descriptor *tx) | | ^~~~~~~~~~~~~~~~~~~ | | | | | (12) entry to 'dma_cookie_complete' | 'dma_cookie_complete': event 13 | |include/asm-generic/bug.h:65:35: | 65 | #define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) | | ^ | | | | | (13) following 'false' branch... drivers/dma/qcom/../dmaengine.h:54:9: note: in expansion of macro 'BUG_ON' | 54 | BUG_ON(tx->cookie < DMA_MIN_COOKIE); | | ^~~~~~ | 'dma_cookie_complete': events 14-15 | | 55 | tx->chan->completed_cookie = tx->cookie; | | ~~^~~~~~ | | | | | (14) ...to here | | (15) use of uninitialized value '*tx.chan' here | In file included from include/linux/kernel.h:12, from include/linux/list.h:9, from include/linux/rculist.h:10, from include/linux/pid.h:5, from include/linux/sched.h:14, from include/linux/ratelimit.h:6, from include/linux/dev_printk.h:16: drivers/dma/qcom/hidma.c: In function 'hidma_process_completed': >> include/linux/container_of.h:18:15: warning: use of uninitialized value >> '((struct hidma_desc *)((char *)__mptr + 28))[71582787].node.next' [CWE-457] >> [-Wanalyzer-use-of-uninitialized-value] 18 | void *__mptr = (void *)(ptr); \ | ^~~~~~ include/linux/list.h:511:9: note: in expansion of macro 'container_of' 511 | container_of(ptr, type, member) | ^~~~~~~~~~~~ include/linux/list.h:555:9: note: in expansion of macro 'list_entry' 555 | list_entry((pos)->member.next, typeof(*(pos)), member) | ^~~~~~~~~~ include/linux/list.h:716:21: note: in expansion of macro 'list_next_entry' 716 | n = list_next_entry(pos, member); \ | ^~~~~~~~~~~~~~~ drivers/dma/qcom/hidma.c:127:9: note: in expansion of macro 'list_for_each_entry_safe' 127 | list_for_each_entry_safe(mdesc, next, &list, node) { | ^~~~~~~~~~~~~~~~~~~~~~~~ 'hidma_process_completed': event 1 | | 117 | struct list_head list; | | ^~~~ | | | | | (1) region created on stack here | 'hidma_process_completed': event 2 | |include/linux/list.h:498:12: | 498 | if (!list_empty(list)) { | | ^ | | | | | (2) following 'false' branch... | 'hidma_process_completed': event 3 | |include/linux/spinlock.h:293:17: | 293 | _raw_spin_unlock_irqrestore(lock, flags); \ | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (3) ...to here include/linux/spinlock.h:417:9: note: in expansion of macro 'raw_spin_unlock_irqrestore' | 417 | raw_spin_unlock_irqrestore(&lock->rlock, flags); | | ^~~~~~~~~~~~~~~~~~~~~~~~~~ | 'hidma_process_completed': event 4 | |include/linux/container_of.h:18:15: | 18 | void *__mptr = (void *)(ptr); \ | | ^~~~~~ | | | | | (4) use of uninitialized value '((struct hidma_desc *)((char *)__mptr + 28))[71582787].node.next' here include/linux/list.h:511:9: note: in expansion of macro 'container_of' | 511 | container_of(ptr, type, member) | | ^~~~~~~~~~~~ include/linux/list.h:555:9: note: in expansion of macro 'list_entry' | 555 | list_entry((pos)->member.next, typeof(*(pos)), member) | | ^~~~~~~~~~ include/linux/list.h:716:21: note: in expansion of macro 'list_next_entry' | 716 | n = list_next_entry(pos, member); \ | | ^~~~~~~~~~~~~~~ drivers/dma/qcom/hidma.c:127:9: note: in expansion of macro 'list_for_each_entry_safe' | 127 | list_for_each_entry_safe(mdesc, next, &list, node) { | | ^~~~~~~~~~~~~~~~~~~~~~~~ | >> include/linux/container_of.h:18:15: warning: use of uninitialized value >> '((struct hidma_desc *)((char *)__mptr + 28))[71582787].node.next' [CWE-457] >> [-Wanalyzer-use-of-uninitialized-value] 18 | void *__mptr = (void *)(ptr); \ | ^~~~~~ include/linux/list.h:511:9: note: in expansion of macro 'container_of' 511 | container_of(ptr, type, member) | ^~~~~~~~~~~~ include/linux/list.h:555:9: note: in expansion of macro 'list_entry' 555 | list_entry((pos)->member.next, typeof(*(pos)), member) | ^~~~~~~~~~ include/linux/list.h:716:21: note: in expansion of macro 'list_next_entry' 716 | n = list_next_entry(pos, member); \ | ^~~~~~~~~~~~~~~ drivers/dma/qcom/hidma.c:127:9: note: in expansion of macro 'list_for_each_entry_safe' 127 | list_for_each_entry_safe(mdesc, next, &list, node) { | ^~~~~~~~~~~~~~~~~~~~~~~~ 'hidma_terminate_channel': events 1-2 | | 459 | static int hidma_terminate_channel(struct dma_chan *chan) | | ^~~~~~~~~~~~~~~~~~~~~~~ | | | | | (1) entry to 'hidma_terminate_channel' |...... | 470 | hidma_process_completed(mchan); | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (2) calling 'hidma_process_completed' from 'hidma_terminate_channel' | +--> 'hidma_process_completed': events 3-4 | | 108 | static void hidma_process_completed(struct hidma_chan *mchan) | | ^~~~~~~~~~~~~~~~~~~~~~~ | | | | | (3) entry to 'hidma_process_completed' |...... | 117 | struct list_head list; | | ~~~~ | | | | | (4) region created on stack here | 'hidma_process_completed': event 5 | |include/linux/list.h:498:12: | 498 | if (!list_empty(list)) { | | ^ | | | | | (5) following 'false' branch... | 'hidma_process_completed': event 6 | |include/linux/spinlock.h:293:17: | 293 | _raw_spin_unlock_irqrestore(lock, flags); \ | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (6) ...to here include/linux/spinlock.h:417:9: note: in expansion of macro 'raw_spin_unlock_irqrestore' | 417 | raw_spin_unlock_irqrestore(&lock->rlock, flags); | | ^~~~~~~~~~~~~~~~~~~~~~~~~~ | 'hidma_process_completed': event 7 | |include/linux/container_of.h:18:15: | 18 | void *__mptr = (void *)(ptr); \ | | ^~~~~~ | | | | | (7) use of uninitialized value '((struct hidma_desc *)((char *)__mptr + 28))[71582787].node.next' here include/linux/list.h:511:9: note: in expansion of macro 'container_of' | 511 | container_of(ptr, type, member) | | ^~~~~~~~~~~~ include/linux/list.h:555:9: note: in expansion of macro 'list_entry' | 555 | list_entry((pos)->member.next, typeof(*(pos)), member) | | ^~~~~~~~~~ include/linux/list.h:716:21: note: in expansion of macro 'list_next_entry' | 716 | n = list_next_entry(pos, member); \ | | ^~~~~~~~~~~~~~~ drivers/dma/qcom/hidma.c:127:9: note: in expansion of macro 'list_for_each_entry_safe' | 127 | list_for_each_entry_safe(mdesc, next, &list, node) { | | ^~~~~~~~~~~~~~~~~~~~~~~~ | >> include/linux/container_of.h:18:15: warning: use of uninitialized value >> '((struct hidma_desc *)((char *)__mptr + 28))[71582787].node.next' [CWE-457] >> [-Wanalyzer-use-of-uninitialized-value] 18 | void *__mptr = (void *)(ptr); \ | ^~~~~~ include/linux/list.h:511:9: note: in expansion of macro 'container_of' 511 | container_of(ptr, type, member) | ^~~~~~~~~~~~ include/linux/list.h:555:9: note: in expansion of macro 'list_entry' 555 | list_entry((pos)->member.next, typeof(*(pos)), member) | ^~~~~~~~~~ include/linux/list.h:716:21: note: in expansion of macro 'list_next_entry' 716 | n = list_next_entry(pos, member); \ | ^~~~~~~~~~~~~~~ drivers/dma/qcom/hidma.c:127:9: note: in expansion of macro 'list_for_each_entry_safe' 127 | list_for_each_entry_safe(mdesc, next, &list, node) { | ^~~~~~~~~~~~~~~~~~~~~~~~ 'hidma_callback': events 1-2 | | 165 | static void hidma_callback(void *data) | | ^~~~~~~~~~~~~~ | | | | | (1) entry to 'hidma_callback' |...... | 186 | hidma_process_completed(mchan); | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (2) calling 'hidma_process_completed' from 'hidma_callback' | +--> 'hidma_process_completed': events 3-4 | | 108 | static void hidma_process_completed(struct hidma_chan *mchan) | | ^~~~~~~~~~~~~~~~~~~~~~~ | | | | | (3) entry to 'hidma_process_completed' |...... | 117 | struct list_head list; | | ~~~~ | | | | | (4) region created on stack here | 'hidma_process_completed': event 5 | |include/linux/list.h:498:12: | 498 | if (!list_empty(list)) { | | ^ | | | | | (5) following 'false' branch... | 'hidma_process_completed': event 6 | |include/linux/spinlock.h:293:17: | 293 | _raw_spin_unlock_irqrestore(lock, flags); \ | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (6) ...to here include/linux/spinlock.h:417:9: note: in expansion of macro 'raw_spin_unlock_irqrestore' | 417 | raw_spin_unlock_irqrestore(&lock->rlock, flags); | | ^~~~~~~~~~~~~~~~~~~~~~~~~~ | 'hidma_process_completed': event 7 | |include/linux/container_of.h:18:15: | 18 | void *__mptr = (void *)(ptr); \ | | ^~~~~~ | | | | | (7) use of uninitialized value '((struct hidma_desc *)((char *)__mptr + 28))[71582787].node.next' here include/linux/list.h:511:9: note: in expansion of macro 'container_of' | 511 | container_of(ptr, type, member) | | ^~~~~~~~~~~~ include/linux/list.h:555:9: note: in expansion of macro 'list_entry' | 555 | list_entry((pos)->member.next, typeof(*(pos)), member) | | ^~~~~~~~~~ include/linux/list.h:716:21: note: in expansion of macro 'list_next_entry' | 716 | n = list_next_entry(pos, member); \ | | ^~~~~~~~~~~~~~~ drivers/dma/qcom/hidma.c:127:9: note: in expansion of macro 'list_for_each_entry_safe' | 127 | list_for_each_entry_safe(mdesc, next, &list, node) { | | ^~~~~~~~~~~~~~~~~~~~~~~~ | >> include/linux/container_of.h:18:15: warning: use of uninitialized value >> '((struct hidma_desc *)((char *)__mptr + 28))[71582787].node.next' [CWE-457] >> [-Wanalyzer-use-of-uninitialized-value] 18 | void *__mptr = (void *)(ptr); \ | ^~~~~~ include/linux/list.h:511:9: note: in expansion of macro 'container_of' 511 | container_of(ptr, type, member) | ^~~~~~~~~~~~ include/linux/list.h:555:9: note: in expansion of macro 'list_entry' 555 | list_entry((pos)->member.next, typeof(*(pos)), member) | ^~~~~~~~~~ include/linux/list.h:716:21: note: in expansion of macro 'list_next_entry' 716 | n = list_next_entry(pos, member); \ | ^~~~~~~~~~~~~~~ drivers/dma/qcom/hidma.c:127:9: note: in expansion of macro 'list_for_each_entry_safe' 127 | list_for_each_entry_safe(mdesc, next, &list, node) { | ^~~~~~~~~~~~~~~~~~~~~~~~ 'hidma_free_chan_resources': events 1-2 | | 524 | static void hidma_free_chan_resources(struct dma_chan *dmach) | | ^~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (1) entry to 'hidma_free_chan_resources' |...... | 533 | hidma_terminate_channel(dmach); | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (2) calling 'hidma_terminate_channel' from 'hidma_free_chan_resources' | +--> 'hidma_terminate_channel': events 3-4 | | 459 | static int hidma_terminate_channel(struct dma_chan *chan) | | ^~~~~~~~~~~~~~~~~~~~~~~ | | | | | (3) entry to 'hidma_terminate_channel' |...... | 470 | hidma_process_completed(mchan); | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (4) calling 'hidma_process_completed' from 'hidma_terminate_channel' | +--> 'hidma_process_completed': events 5-6 | | 108 | static void hidma_process_completed(struct hidma_chan *mchan) | | ^~~~~~~~~~~~~~~~~~~~~~~ | | | | | (5) entry to 'hidma_process_completed' |...... | 117 | struct list_head list; | | ~~~~ | | | | | (6) region created on stack here | 'hidma_process_completed': event 7 | |include/linux/list.h:498:12: | 498 | if (!list_empty(list)) { | | ^ | | | | | (7) following 'false' branch... | 'hidma_process_completed': event 8 | |include/linux/spinlock.h:293:17: | 293 | _raw_spin_unlock_irqrestore(lock, flags); \ | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (8) ...to here include/linux/spinlock.h:417:9: note: in expansion of macro 'raw_spin_unlock_irqrestore' | 417 | raw_spin_unlock_irqrestore(&lock->rlock, flags); | | ^~~~~~~~~~~~~~~~~~~~~~~~~~ | 'hidma_process_completed': event 9 | |include/linux/container_of.h:18:15: | 18 | void *__mptr = (void *)(ptr); \ | | ^~~~~~ | | | | | (9) use of uninitialized value '((struct hidma_desc *)((char *)__mptr + 28))[71582787].node.next' here include/linux/list.h:511:9: note: in expansion of macro 'container_of' | 511 | container_of(ptr, type, member) | | ^~~~~~~~~~~~ include/linux/list.h:555:9: note: in expansion of macro 'list_entry' | 555 | list_entry((pos)->member.next, typeof(*(pos)), member) | | ^~~~~~~~~~ include/linux/list.h:716:21: note: in expansion of macro 'list_next_entry' | 716 | n = list_next_entry(pos, member); \ | | ^~~~~~~~~~~~~~~ drivers/dma/qcom/hidma.c:127:9: note: in expansion of macro 'list_for_each_entry_safe' | 127 | list_for_each_entry_safe(mdesc, next, &list, node) { | | ^~~~~~~~~~~~~~~~~~~~~~~~ | >> include/linux/container_of.h:18:15: warning: use of uninitialized value >> '((struct hidma_desc *)((char *)__mptr + 28))[71582787].node.next' [CWE-457] >> [-Wanalyzer-use-of-uninitialized-value] 18 | void *__mptr = (void *)(ptr); \ | ^~~~~~ include/linux/list.h:511:9: note: in expansion of macro 'container_of' 511 | container_of(ptr, type, member) | ^~~~~~~~~~~~ include/linux/list.h:555:9: note: in expansion of macro 'list_entry' 555 | list_entry((pos)->member.next, typeof(*(pos)), member) | ^~~~~~~~~~ include/linux/list.h:716:21: note: in expansion of macro 'list_next_entry' 716 | n = list_next_entry(pos, member); \ | ^~~~~~~~~~~~~~~ drivers/dma/qcom/hidma.c:127:9: note: in expansion of macro 'list_for_each_entry_safe' 127 | list_for_each_entry_safe(mdesc, next, &list, node) { | ^~~~~~~~~~~~~~~~~~~~~~~~ 'hidma_terminate_all': events 1-2 | | 506 | static int hidma_terminate_all(struct dma_chan *chan) | | ^~~~~~~~~~~~~~~~~~~ | | | | | (1) entry to 'hidma_terminate_all' |...... | 512 | rc = hidma_terminate_channel(chan); | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (2) calling 'hidma_terminate_channel' from 'hidma_terminate_all' | +--> 'hidma_terminate_channel': events 3-4 | | 459 | static int hidma_terminate_channel(struct dma_chan *chan) | | ^~~~~~~~~~~~~~~~~~~~~~~ | | | | | (3) entry to 'hidma_terminate_channel' |...... | 470 | hidma_process_completed(mchan); | | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (4) calling 'hidma_process_completed' from 'hidma_terminate_channel' | +--> 'hidma_process_completed': events 5-6 | | 108 | static void hidma_process_completed(struct hidma_chan *mchan) | | ^~~~~~~~~~~~~~~~~~~~~~~ | | | | | (5) entry to 'hidma_process_completed' |...... | 117 | struct list_head list; | | ~~~~ | | | | | (6) region created on stack here | 'hidma_process_completed': event 7 | |include/linux/list.h:498:12: | 498 | if (!list_empty(list)) { | | ^ | | | | | (7) following 'false' branch... | 'hidma_process_completed': event 8 | |include/linux/spinlock.h:293:17: | 293 | _raw_spin_unlock_irqrestore(lock, flags); \ | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | | | (8) ...to here include/linux/spinlock.h:417:9: note: in expansion of macro 'raw_spin_unlock_irqrestore' | 417 | raw_spin_unlock_irqrestore(&lock->rlock, flags); | | ^~~~~~~~~~~~~~~~~~~~~~~~~~ | 'hidma_process_completed': event 9 | |include/linux/container_of.h:18:15: | 18 | void *__mptr = (void *)(ptr); \ | | ^~~~~~ | | | | | (9) use of uninitialized value '((struct hidma_desc *)((char *)__mptr + 28))[71582787].node.next' here include/linux/list.h:511:9: note: in expansion of macro 'container_of' | 511 | container_of(ptr, type, member) | | ^~~~~~~~~~~~ include/linux/list.h:555:9: note: in expansion of macro 'list_entry' | 555 | list_entry((pos)->member.next, typeof(*(pos)), member) | | ^~~~~~~~~~ include/linux/list.h:716:21: note: in expansion of macro 'list_next_entry' | 716 | n = list_next_entry(pos, member); \ | | ^~~~~~~~~~~~~~~ drivers/dma/qcom/hidma.c:127:9: note: in expansion of macro 'list_for_each_entry_safe' | 127 | list_for_each_entry_safe(mdesc, next, &list, node) { | | ^~~~~~~~~~~~~~~~~~~~~~~~ | drivers/dma/qcom/hidma.c:133:29: warning: use of uninitialized value '*(struct dma_async_tx_descriptor *)mdesc.cookie' [CWE-457] [-Wanalyzer-use-of-uninitialized-value] 133 | last_cookie = desc->cookie; | ~~~~~~~~~~~~^~~~~~~~~~~~~~ 'hidma_process_completed': event 1 | | 117 | struct list_head list; | | ^~~~ | | | | | (1) region created on stack here | 'hidma_process_completed': event 2 vim +18 include/linux/container_of.h d2a8ebbf8192b84 Andy Shevchenko 2021-11-08 9 d2a8ebbf8192b84 Andy Shevchenko 2021-11-08 10 /** d2a8ebbf8192b84 Andy Shevchenko 2021-11-08 11 * container_of - cast a member of a structure out to the containing structure d2a8ebbf8192b84 Andy Shevchenko 2021-11-08 12 * @ptr: the pointer to the member. d2a8ebbf8192b84 Andy Shevchenko 2021-11-08 13 * @type: the type of the container struct this is embedded in. d2a8ebbf8192b84 Andy Shevchenko 2021-11-08 14 * @member: the name of the member within the struct. d2a8ebbf8192b84 Andy Shevchenko 2021-11-08 15 * d2a8ebbf8192b84 Andy Shevchenko 2021-11-08 16 */ d2a8ebbf8192b84 Andy Shevchenko 2021-11-08 17 #define container_of(ptr, type, member) ({ \ d2a8ebbf8192b84 Andy Shevchenko 2021-11-08 @18 void *__mptr = (void *)(ptr); \ d2a8ebbf8192b84 Andy Shevchenko 2021-11-08 19 BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ d2a8ebbf8192b84 Andy Shevchenko 2021-11-08 20 !__same_type(*(ptr), void), \ d2a8ebbf8192b84 Andy Shevchenko 2021-11-08 21 "pointer type mismatch in container_of()"); \ d2a8ebbf8192b84 Andy Shevchenko 2021-11-08 22 ((type *)(__mptr - offsetof(type, member))); }) d2a8ebbf8192b84 Andy Shevchenko 2021-11-08 23 -- 0-DAY CI Kernel Test Service https://01.org/lkp _______________________________________________ kbuild mailing list -- kbuild@lists.01.org To unsubscribe send an email to kbuild-le...@lists.01.org