CC: [email protected]
CC: [email protected]
CC: [email protected]
TO: Kees Cook <[email protected]>
CC: Miguel Ojeda <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   0280e3c58f92b2fe0e8fbbdf8d386449168de4a8
commit: c80d92fbb67b2c80b8eeb8759ee79d676eb33520 compiler_types.h: Remove 
__compiletime_object_size()
date:   4 months ago
:::::: branch date: 24 hours ago
:::::: commit date: 4 months ago
config: riscv-randconfig-c006-20220125 
(https://download.01.org/0day-ci/archive/20220127/[email protected]/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 
997e128e2a78f5a5434fc75997441ae1ee76f8a4)
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 riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c80d92fbb67b2c80b8eeb8759ee79d676eb33520
        git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout c80d92fbb67b2c80b8eeb8759ee79d676eb33520
        # save the config file to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv 
clang-analyzer 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>


clang-analyzer warnings: (new ones prefixed by >>)
   5 warnings generated.
   drivers/iio/dac/ad5755.c:88:8: warning: Excessive padding in 'struct 
ad5755_state' (100 padding bytes, where 36 is optimal). 
   Optimal fields order: 
   data, 
   spi, 
   chip_info, 
   pwr_down, 
   ctrl, 
   lock, 
   channels, 
   consider reordering the fields or adding explicit padding members 
[clang-analyzer-optin.performance.Padding]
   struct ad5755_state {
   ~~~~~~~^~~~~~~~~~~~~~
   drivers/iio/dac/ad5755.c:88:8: note: Excessive padding in 'struct 
ad5755_state' (100 padding bytes, where 36 is optimal). Optimal fields order: 
data, spi, chip_info, pwr_down, ctrl, lock, channels, consider reordering the 
fields or adding explicit padding members
   struct ad5755_state {
   ~~~~~~~^~~~~~~~~~~~~~
   drivers/iio/dac/ad5755.c:729:37: warning: Value stored to 'pdata' during its 
initialization is never read [clang-analyzer-deadcode.DeadStores]
           const struct ad5755_platform_data *pdata = 
dev_get_platdata(&spi->dev);
                                              ^~~~~   
~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/dac/ad5755.c:729:37: note: Value stored to 'pdata' during its 
initialization is never read
           const struct ad5755_platform_data *pdata = 
dev_get_platdata(&spi->dev);
                                              ^~~~~   
~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 3 warnings (2 in non-user code, 1 with check filters).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   4 warnings generated.
   drivers/iio/dac/ad5761.c:63:8: warning: Excessive padding in 'struct 
ad5761_state' (75 padding bytes, where 11 is optimal). 
   Optimal fields order: 
   data, 
   spi, 
   vref_reg, 
   vref, 
   range, 
   lock, 
   use_intref, 
   consider reordering the fields or adding explicit padding members 
[clang-analyzer-optin.performance.Padding]
   struct ad5761_state {
   ~~~~~~~^~~~~~~~~~~~~~
   drivers/iio/dac/ad5761.c:63:8: note: Excessive padding in 'struct 
ad5761_state' (75 padding bytes, where 11 is optimal). Optimal fields order: 
data, spi, vref_reg, vref, range, lock, use_intref, consider reordering the 
fields or adding explicit padding members
   struct ad5761_state {
   ~~~~~~~^~~~~~~~~~~~~~
   Suppressed 3 warnings (3 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.
   4 warnings generated.
   drivers/input/keyboard/lm8323.c:333:3: warning: Value stored to 'active' is 
never read [clang-analyzer-deadcode.DeadStores]
                   active = debounce + 3;
                   ^        ~~~~~~~~~~~~
   drivers/input/keyboard/lm8323.c:333:3: note: Value stored to 'active' is 
never read
                   active = debounce + 3;
                   ^        ~~~~~~~~~~~~
   Suppressed 3 warnings (3 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.
   3 warnings generated.
   Suppressed 3 warnings (3 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   3 warnings generated.
   Suppressed 3 warnings (3 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   3 warnings generated.
>> drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c:129:7: 
>> warning: Branch condition evaluates to a garbage value 
>> [clang-analyzer-core.uninitialized.Branch]
                   if (!elements[i].data && elements[i].size != 0)
                       ^
   drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c:601:18: note: 
Assuming 'vchiq_arm_log_level' is < 7
           vchiq_log_trace(vchiq_arm_log_level,
                           ^
   drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h:60:11: note: 
expanded from macro 'vchiq_log_trace'
           do { if (cat >= VCHIQ_LOG_TRACE) \
                    ^~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c:601:2: note: 
Taking false branch
           vchiq_log_trace(vchiq_arm_log_level,
           ^
   drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h:60:7: note: 
expanded from macro 'vchiq_log_trace'
           do { if (cat >= VCHIQ_LOG_TRACE) \
                ^
   drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c:601:2: note: 
Loop condition is false.  Exiting loop
           vchiq_log_trace(vchiq_arm_log_level,
           ^
   drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h:60:2: note: 
expanded from macro 'vchiq_log_trace'
           do { if (cat >= VCHIQ_LOG_TRACE) \
           ^
   drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c:608:2: note: 
Control jumps to 'case 1074578436:'  at line 738
           switch (cmd) {
           ^
   drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c:741:7: note: 
Assuming the condition is false
                   if (copy_from_user(&args, (const void __user *)arg,
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c:741:3: note: 
Taking false branch
                   if (copy_from_user(&args, (const void __user *)arg,
                   ^
   drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c:749:7: note: 
Assuming 'service' is non-null
                   if (service && (args.count <= MAX_ELEMENTS)) {
                       ^~~~~~~
   drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c:749:7: note: 
Left side of '&&' is true
   drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c:749:19: note: 
Assuming field 'count' is <= MAX_ELEMENTS
                   if (service && (args.count <= MAX_ELEMENTS)) {
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c:749:3: note: 
Taking true branch
                   if (service && (args.count <= MAX_ELEMENTS)) {
                   ^
   drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c:753:8: note: 
Calling 'copy_from_user'
                           if (copy_from_user(elements, args.elements,
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/uaccess.h:191:2: note: Taking false branch
           if (likely(check_copy_size(to, n, false)))
           ^
   include/linux/uaccess.h:193:2: note: Returning without writing to 
'to->data', which participates in a condition later
           return n;
           ^
   include/linux/uaccess.h:193:2: note: Returning without writing to 'to->data'
   drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c:753:8: note: 
Returning from 'copy_from_user'
                           if (copy_from_user(elements, args.elements,
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c:753:8: note: 
Assuming the condition is true
                           if (copy_from_user(elements, args.elements,
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c:753:4: note: 
Taking true branch
                           if (copy_from_user(elements, args.elements,
                           ^
   drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c:755:11: note: 
Calling 'vchiq_ioc_queue_message'
                                   ret = vchiq_ioc_queue_message(args.handle, 
elements,
                                         
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c:128:14: note: 
Assuming 'i' is < 'count'
           for (i = 0; i < count; i++) {
                       ^~~~~~~~~
   drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c:128:2: note: 
Loop condition is true.  Entering loop body
           for (i = 0; i < count; i++) {
           ^
   drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c:129:7: note: 
Branch condition evaluates to a garbage value
                   if (!elements[i].data && elements[i].size != 0)
                       ^~~~~~~~~~~~~~~~~
   Suppressed 2 warnings (2 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.
   4 warnings generated.
   drivers/spi/spi-tegra20-slink.c:952:3: warning: Value stored to 'err' is 
never read [clang-analyzer-deadcode.DeadStores]
                   err = tegra_slink_start_dma_based_transfer(tspi, t);
                   ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/spi/spi-tegra20-slink.c:952:3: note: Value stored to 'err' is never 
read
                   err = tegra_slink_start_dma_based_transfer(tspi, t);
                   ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/spi/spi-tegra20-slink.c:954:3: warning: Value stored to 'err' is 
never read [clang-analyzer-deadcode.DeadStores]
                   err = tegra_slink_start_cpu_based_transfer(tspi, t);
                   ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/spi/spi-tegra20-slink.c:954:3: note: Value stored to 'err' is never 
read
                   err = tegra_slink_start_cpu_based_transfer(tspi, t);
                   ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   Suppressed 2 warnings (2 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   3 warnings generated.
   Suppressed 3 warnings (3 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   2 warnings generated.
   Suppressed 2 warnings (2 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.
   2 warnings generated.

vim +129 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c

f05916281fd75d Ojaswin Mujoo 2021-07-21  114  
f05916281fd75d Ojaswin Mujoo 2021-07-21  115  static int
f05916281fd75d Ojaswin Mujoo 2021-07-21  116  vchiq_ioc_queue_message(unsigned 
int handle, struct vchiq_element *elements,
f05916281fd75d Ojaswin Mujoo 2021-07-21  117                    unsigned long 
count)
f05916281fd75d Ojaswin Mujoo 2021-07-21  118  {
f05916281fd75d Ojaswin Mujoo 2021-07-21  119    struct 
vchiq_io_copy_callback_context context;
f05916281fd75d Ojaswin Mujoo 2021-07-21  120    enum vchiq_status status = 
VCHIQ_SUCCESS;
f05916281fd75d Ojaswin Mujoo 2021-07-21  121    unsigned long i;
f05916281fd75d Ojaswin Mujoo 2021-07-21  122    size_t total_size = 0;
f05916281fd75d Ojaswin Mujoo 2021-07-21  123  
f05916281fd75d Ojaswin Mujoo 2021-07-21  124    context.element = elements;
f05916281fd75d Ojaswin Mujoo 2021-07-21  125    context.element_offset = 0;
f05916281fd75d Ojaswin Mujoo 2021-07-21  126    context.elements_to_go = count;
f05916281fd75d Ojaswin Mujoo 2021-07-21  127  
f05916281fd75d Ojaswin Mujoo 2021-07-21  128    for (i = 0; i < count; i++) {
f05916281fd75d Ojaswin Mujoo 2021-07-21 @129            if (!elements[i].data 
&& elements[i].size != 0)
f05916281fd75d Ojaswin Mujoo 2021-07-21  130                    return -EFAULT;
f05916281fd75d Ojaswin Mujoo 2021-07-21  131  
f05916281fd75d Ojaswin Mujoo 2021-07-21  132            total_size += 
elements[i].size;
f05916281fd75d Ojaswin Mujoo 2021-07-21  133    }
f05916281fd75d Ojaswin Mujoo 2021-07-21  134  
f05916281fd75d Ojaswin Mujoo 2021-07-21  135    status = 
vchiq_queue_message(handle, vchiq_ioc_copy_element_data,
f05916281fd75d Ojaswin Mujoo 2021-07-21  136                                 
&context, total_size);
f05916281fd75d Ojaswin Mujoo 2021-07-21  137  
f05916281fd75d Ojaswin Mujoo 2021-07-21  138    if (status == VCHIQ_ERROR)
f05916281fd75d Ojaswin Mujoo 2021-07-21  139            return -EIO;
f05916281fd75d Ojaswin Mujoo 2021-07-21  140    else if (status == VCHIQ_RETRY)
f05916281fd75d Ojaswin Mujoo 2021-07-21  141            return -EINTR;
f05916281fd75d Ojaswin Mujoo 2021-07-21  142    return 0;
f05916281fd75d Ojaswin Mujoo 2021-07-21  143  }
f05916281fd75d Ojaswin Mujoo 2021-07-21  144  

:::::: The code at line 129 was first introduced by commit
:::::: f05916281fd75db2fe32294e26c04d666c762370 staging: vchiq: Move vchiq char 
driver to its own file

:::::: TO: Ojaswin Mujoo <[email protected]>
:::::: CC: Greg Kroah-Hartman <[email protected]>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to