tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 089866061428ec9bf67221247c936792078c41a4 commit: 3a29355a22c0275fe864100794fee58a73175d93 gpio: Add virtio-gpio driver date: 10 months ago config: arm-randconfig-c002-20220629 compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project a9119143a2d1f4d0d0bc1fe0d819e5351b4e0deb) 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 # install arm cross compiling tool for clang build # apt-get install binutils-arm-linux-gnueabi # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3a29355a22c0275fe864100794fee58a73175d93 git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git git fetch --no-tags linus master git checkout 3a29355a22c0275fe864100794fee58a73175d93 # save the config file COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm clang-analyzer If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot clang-analyzer warnings: (new ones prefixed by >>) lib/rhashtable.c:792:21: note: Value stored to 'p' during its initialization is never read struct rhash_head *p = iter->p; ^ ~~~~~~~ 2 warnings generated. drivers/dma/sf-pdma/sf-pdma.c:59:6: warning: Access to field 'desc' results in a dereference of a null pointer (loaded from variable 'chan') [clang-analyzer-core.NullDereference] if (chan->desc && !chan->desc->in_use) { ^ drivers/dma/sf-pdma/sf-pdma.c:95:30: note: Calling 'to_sf_pdma_chan' struct sf_pdma_chan *chan = to_sf_pdma_chan(dchan); ^~~~~~~~~~~~~~~~~~~~~~ drivers/dma/sf-pdma/sf-pdma.c:44:9: note: Left side of '&&' is false return container_of(dchan, struct sf_pdma_chan, vchan.chan); ^ include/linux/kernel.h:495:61: note: expanded from macro 'container_of' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ drivers/dma/sf-pdma/sf-pdma.c:44:9: note: Taking false branch return container_of(dchan, struct sf_pdma_chan, vchan.chan); ^ include/linux/kernel.h:495:2: note: expanded from macro 'container_of' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG' #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) ^ include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ^ include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert' __compiletime_assert(condition, msg, prefix, suffix) ^ include/linux/compiler_types.h:308:3: note: expanded from macro '__compiletime_assert' if (!(condition)) \ ^ drivers/dma/sf-pdma/sf-pdma.c:44:9: note: Loop condition is false. Exiting loop return container_of(dchan, struct sf_pdma_chan, vchan.chan); ^ include/linux/kernel.h:495:2: note: expanded from macro 'container_of' BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ ^ include/linux/build_bug.h:39:37: note: expanded from macro 'BUILD_BUG_ON_MSG' #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) ^ include/linux/compiler_types.h:328:2: note: expanded from macro 'compiletime_assert' _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__) ^ include/linux/compiler_types.h:316:2: note: expanded from macro '_compiletime_assert' __compiletime_assert(condition, msg, prefix, suffix) ^ include/linux/compiler_types.h:306:2: note: expanded from macro '__compiletime_assert' do { \ ^ drivers/dma/sf-pdma/sf-pdma.c:44:2: note: Returning pointer, which participates in a condition later return container_of(dchan, struct sf_pdma_chan, vchan.chan); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/dma/sf-pdma/sf-pdma.c:44:2: note: Returning pointer return container_of(dchan, struct sf_pdma_chan, vchan.chan); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/dma/sf-pdma/sf-pdma.c:95:30: note: Returning from 'to_sf_pdma_chan' struct sf_pdma_chan *chan = to_sf_pdma_chan(dchan); ^~~~~~~~~~~~~~~~~~~~~~ drivers/dma/sf-pdma/sf-pdma.c:95:2: note: 'chan' initialized here struct sf_pdma_chan *chan = to_sf_pdma_chan(dchan); ^~~~~~~~~~~~~~~~~~~~~~~~~ drivers/dma/sf-pdma/sf-pdma.c:99:6: note: Assuming 'chan' is null if (chan && (!len || !dest || !src)) { ^~~~ drivers/dma/sf-pdma/sf-pdma.c:99:11: note: Left side of '&&' is false if (chan && (!len || !dest || !src)) { ^ drivers/dma/sf-pdma/sf-pdma.c:105:28: note: Passing null pointer value via 1st parameter 'chan' desc = sf_pdma_alloc_desc(chan); ^~~~ drivers/dma/sf-pdma/sf-pdma.c:105:9: note: Calling 'sf_pdma_alloc_desc' desc = sf_pdma_alloc_desc(chan); ^~~~~~~~~~~~~~~~~~~~~~~~ drivers/dma/sf-pdma/sf-pdma.c:57:2: note: Loop condition is false. Exiting loop spin_lock_irqsave(&chan->lock, flags); ^ include/linux/spinlock.h:384:2: note: expanded from macro 'spin_lock_irqsave' raw_spin_lock_irqsave(spinlock_check(lock), flags); \ ^ include/linux/spinlock.h:250:2: note: expanded from macro 'raw_spin_lock_irqsave' do { \ ^ drivers/dma/sf-pdma/sf-pdma.c:57:2: note: Loop condition is false. Exiting loop spin_lock_irqsave(&chan->lock, flags); ^ include/linux/spinlock.h:382:43: note: expanded from macro 'spin_lock_irqsave' #define spin_lock_irqsave(lock, flags) \ ^ drivers/dma/sf-pdma/sf-pdma.c:59:6: note: Access to field 'desc' results in a dereference of a null pointer (loaded from variable 'chan') if (chan->desc && !chan->desc->in_use) { ^~~~ Suppressed 1 warnings (1 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 1 warning generated. Suppressed 1 warnings (1 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 1 warning generated. >> drivers/gpio/gpio-virtio.c:23:8: warning: Excessive padding in 'struct virtio_gpio_line' (58 padding bytes, where 26 is optimal). Optimal fields order: res, rxlen, lock, completion, req, consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding] struct virtio_gpio_line { ~~~~~~~^~~~~~~~~~~~~~~~~~ drivers/gpio/gpio-virtio.c:23:8: note: Excessive padding in 'struct virtio_gpio_line' (58 padding bytes, where 26 is optimal). Optimal fields order: res, rxlen, lock, completion, req, consider reordering the fields or adding explicit padding members struct virtio_gpio_line { ~~~~~~~^~~~~~~~~~~~~~~~~~ 1 warning generated. drivers/pwm/core.c:818:13: warning: Access to field 'name' results in a dereference of a null pointer (loaded from variable 'np') [clang-analyzer-core.NullDereference] con_id = np->name; ^ drivers/pwm/core.c:1150:6: note: Assuming the condition is true if (is_of_node(fwnode)) ^~~~~~~~~~~~~~~~~~ drivers/pwm/core.c:1150:2: note: Taking true branch if (is_of_node(fwnode)) ^ drivers/pwm/core.c:1151:25: note: Assuming the condition is false pwm = of_pwm_get(dev, to_of_node(fwnode), con_id); ^ include/linux/of.h:164:3: note: expanded from macro 'to_of_node' is_of_node(__to_of_node_fwnode) ? \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/pwm/core.c:1151:25: note: '?' condition is false pwm = of_pwm_get(dev, to_of_node(fwnode), con_id); ^ include/linux/of.h:164:3: note: expanded from macro 'to_of_node' is_of_node(__to_of_node_fwnode) ? \ ^ drivers/pwm/core.c:1151:25: note: Passing null pointer value via 2nd parameter 'np' pwm = of_pwm_get(dev, to_of_node(fwnode), con_id); ^ include/linux/of.h:161:2: note: expanded from macro 'to_of_node' ({ \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/pwm/core.c:1151:9: note: Calling 'of_pwm_get' pwm = of_pwm_get(dev, to_of_node(fwnode), con_id); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/pwm/core.c:775:6: note: Assuming 'con_id' is null if (con_id) { ^~~~~~ drivers/pwm/core.c:775:2: note: Taking false branch if (con_id) { ^ drivers/pwm/core.c:783:6: note: Assuming 'err' is 0 if (err) { ^~~ drivers/pwm/core.c:783:2: note: Taking false branch if (err) { ^ drivers/pwm/core.c:788:25: note: Assuming '__of_fwnode_handle_node' is null pc = fwnode_to_pwmchip(of_fwnode_handle(args.np)); ^ include/linux/of.h:174:3: note: expanded from macro 'of_fwnode_handle' __of_fwnode_handle_node ? \ ^~~~~~~~~~~~~~~~~~~~~~~ drivers/pwm/core.c:788:25: note: '?' condition is false pc = fwnode_to_pwmchip(of_fwnode_handle(args.np)); ^ include/linux/of.h:174:3: note: expanded from macro 'of_fwnode_handle' __of_fwnode_handle_node ? \ ^ drivers/pwm/core.c:789:2: note: Taking false branch if (IS_ERR(pc)) { ^ drivers/pwm/core.c:798:2: note: Taking false branch if (IS_ERR(pwm)) ^ drivers/pwm/core.c:802:2: note: Taking false branch if (IS_ERR(dl)) { ^ drivers/pwm/core.c:814:7: note: 'con_id' is null if (!con_id) { ^~~~~~ drivers/pwm/core.c:814:2: note: Taking true branch if (!con_id) { ^ drivers/pwm/core.c:817:7: note: 'err' is < 0 if (err < 0) ^~~ drivers/pwm/core.c:817:3: note: Taking true branch if (err < 0) ^ drivers/pwm/core.c:818:13: note: Access to field 'name' results in a dereference of a null pointer (loaded from variable 'np') con_id = np->name; ^~ 1 warning generated. Suppressed 1 warnings (1 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 1 warning generated. Suppressed 1 warnings (1 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 1 warning generated. Suppressed 1 warnings (1 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 10 warnings generated. Suppressed 10 warnings (10 with check filters). 1 warning generated. Suppressed 1 warnings (1 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 1 warning generated. Suppressed 1 warnings (1 in non-user code). vim +23 drivers/gpio/gpio-virtio.c 22 > 23 struct virtio_gpio_line { 24 struct mutex lock; /* Protects line operation */ 25 struct completion completion; 26 struct virtio_gpio_request req ____cacheline_aligned; 27 struct virtio_gpio_response res ____cacheline_aligned; 28 unsigned int rxlen; 29 }; 30 -- 0-DAY CI Kernel Test Service https://01.org/lkp