All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com
Subject: drivers/clocksource/timer-goldfish.c:12:8: warning: Excessive padding in 'struct goldfish_timer' (96 padding bytes, where 32 is optimal). Optimal fields order: ced, base, res, cs, consider reordering the fields or adding explicit padding members [clang-an...
Date: Wed, 25 Jan 2023 08:03:12 +0800	[thread overview]
Message-ID: <202301250740.FHUsJmnq-lkp@intel.com> (raw)

:::::: 
:::::: Manual check reason: "low confidence static check warning: drivers/clocksource/timer-goldfish.c:12:8: warning: Excessive padding in 'struct goldfish_timer' (96 padding bytes, where 32 is optimal). Optimal fields order: ced, base, res, cs, consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]"
:::::: 

BCC: lkp@intel.com
CC: llvm@lists.linux.dev
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Laurent Vivier <laurent@vivier.eu>
CC: Geert Uytterhoeven <geert@linux-m68k.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   7bf70dbb18820b37406fdfa2aaf14c2f5c71a11a
commit: c92e7ef16400bf035e8b49c7dd091bfce4f99773 clocksource/drivers: Add a goldfish-timer clocksource
date:   10 months ago
:::::: branch date: 28 hours ago
:::::: commit date: 10 months ago
config: riscv-randconfig-c006-20230118 (https://download.01.org/0day-ci/archive/20230125/202301250740.FHUsJmnq-lkp@intel.com/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 4196ca3278f78c6e19246e54ab0ecb364e37d66a)
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=c92e7ef16400bf035e8b49c7dd091bfce4f99773
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout c92e7ef16400bf035e8b49c7dd091bfce4f99773
        # save the config file
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer  olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv clang-analyzer 

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

clang_analyzer warnings: (new ones prefixed by >>)
                                 ^
   drivers/iio/adc/at91-sama5d2_adc.c:1343:6: note: Assuming the condition is false
           if (iio_trigger_validate_own_device(indio_dev->trig, indio_dev))
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/adc/at91-sama5d2_adc.c:1343:2: note: Taking false branch
           if (iio_trigger_validate_own_device(indio_dev->trig, indio_dev))
           ^
   drivers/iio/adc/at91-sama5d2_adc.c:1346:6: note: Assuming field 'dma_chan' is non-null
           if (st->dma_st.dma_chan)
               ^~~~~~~~~~~~~~~~~~~
   drivers/iio/adc/at91-sama5d2_adc.c:1346:2: note: Taking true branch
           if (st->dma_st.dma_chan)
           ^
   drivers/iio/adc/at91-sama5d2_adc.c:1347:3: note: Calling 'at91_adc_trigger_handler_dma'
                   at91_adc_trigger_handler_dma(indio_dev);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/adc/at91-sama5d2_adc.c:1292:15: note: Loop condition is false.  Exiting loop
           u32 status = at91_adc_readl(st, ISR);
                        ^
   drivers/iio/adc/at91-sama5d2_adc.c:387:2: note: expanded from macro 'at91_adc_readl'
           readl_relaxed((st)->base + (st)->soc_info.platform->layout->reg)
           ^
   arch/riscv/include/asm/mmio.h:116:38: note: expanded from macro 'readl_relaxed'
   #define readl_relaxed(c)        ({ u32 __v; __io_rbr(); __v = readl_cpu(c); __io_rar(); __v; })
                                               ^
   arch/riscv/include/asm/mmio.h:109:21: note: expanded from macro '__io_rbr'
   #define __io_rbr()              do {} while (0)
                                   ^
   drivers/iio/adc/at91-sama5d2_adc.c:1292:15: note: Loop condition is false.  Exiting loop
           u32 status = at91_adc_readl(st, ISR);
                        ^
   drivers/iio/adc/at91-sama5d2_adc.c:387:2: note: expanded from macro 'at91_adc_readl'
           readl_relaxed((st)->base + (st)->soc_info.platform->layout->reg)
           ^
   arch/riscv/include/asm/mmio.h:116:70: note: expanded from macro 'readl_relaxed'
   #define readl_relaxed(c)        ({ u32 __v; __io_rbr(); __v = readl_cpu(c); __io_rar(); __v; })
                                                                               ^
   arch/riscv/include/asm/mmio.h:110:21: note: expanded from macro '__io_rar'
   #define __io_rar()              do {} while (0)
                                   ^
   drivers/iio/adc/at91-sama5d2_adc.c:1294:6: note: Assuming the condition is false
           if (status & AT91_SAMA5D2_IER_GOVRE)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/adc/at91-sama5d2_adc.c:1294:2: note: Taking false branch
           if (status & AT91_SAMA5D2_IER_GOVRE)
           ^
   drivers/iio/adc/at91-sama5d2_adc.c:1300:17: note: Calling 'div_s64'
           sample_count = div_s64(transferred_len, sample_size);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/math64.h:141:9: note: Calling 'div_s64_rem'
           return div_s64_rem(dividend, divisor, &remainder);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/math64.h:43:2: note: Returning zero
           return dividend / divisor;
           ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/math64.h:141:9: note: Returning from 'div_s64_rem'
           return div_s64_rem(dividend, divisor, &remainder);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/math64.h:141:2: note: Returning zero
           return div_s64_rem(dividend, divisor, &remainder);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/adc/at91-sama5d2_adc.c:1300:17: note: Returning from 'div_s64'
           sample_count = div_s64(transferred_len, sample_size);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/adc/at91-sama5d2_adc.c:1300:2: note: The value 0 is assigned to 'sample_count'
           sample_count = div_s64(transferred_len, sample_size);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/adc/at91-sama5d2_adc.c:1306:47: note: Passing the value 0 via 2nd parameter 'divisor'
           interval = div_s64((ns - st->dma_st.dma_ts), sample_count);
                                                        ^~~~~~~~~~~~
   drivers/iio/adc/at91-sama5d2_adc.c:1306:13: note: Calling 'div_s64'
           interval = div_s64((ns - st->dma_st.dma_ts), sample_count);
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/math64.h:141:31: note: Passing the value 0 via 2nd parameter 'divisor'
           return div_s64_rem(dividend, divisor, &remainder);
                                        ^~~~~~~
   include/linux/math64.h:141:9: note: Calling 'div_s64_rem'
           return div_s64_rem(dividend, divisor, &remainder);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/math64.h:42:24: note: Division by zero
           *remainder = dividend % divisor;
                        ~~~~~~~~~^~~~~~~~~
   Suppressed 8 warnings (8 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.
   9 warnings generated.
   drivers/clocksource/ingenic-sysost.c:340:2: warning: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           snprintf(ost->name, sizeof(ost->name), "OST percpu timer");
           ^~~~~~~~
   drivers/clocksource/ingenic-sysost.c:340:2: note: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11
           snprintf(ost->name, sizeof(ost->name), "OST percpu timer");
           ^~~~~~~~
   Suppressed 8 warnings (8 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.
   6 warnings generated.
   Suppressed 6 warnings (6 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.
   8 warnings generated.
   Suppressed 8 warnings (8 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.
   9 warnings generated.
>> drivers/clocksource/timer-goldfish.c:12:8: warning: Excessive padding in 'struct goldfish_timer' (96 padding bytes, where 32 is optimal). Optimal fields order: ced, base, res, cs, consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
   struct goldfish_timer {
   ~~~~~~~^~~~~~~~~~~~~~~~
   drivers/clocksource/timer-goldfish.c:12:8: note: Excessive padding in 'struct goldfish_timer' (96 padding bytes, where 32 is optimal). Optimal fields order: ced, base, res, cs, consider reordering the fields or adding explicit padding members
   struct goldfish_timer {
   ~~~~~~~^~~~~~~~~~~~~~~~
   Suppressed 8 warnings (8 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.
   8 warnings generated.
   drivers/of/base.c:1886:2: warning: Call to function 'strncpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'strncpy_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           strncpy(ap->stem, stem, stem_len);
           ^~~~~~~
   drivers/of/base.c:1886:2: note: Call to function 'strncpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'strncpy_s' in case of C11
           strncpy(ap->stem, stem, stem_len);
           ^~~~~~~
   Suppressed 7 warnings (7 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.
   6 warnings generated.
   Suppressed 6 warnings (6 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.
   11 warnings generated.
   sound/firewire/digi00x/digi00x.c:34:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
           strcpy(dg00x->card->shortname, model);
           ^~~~~~
   sound/firewire/digi00x/digi00x.c:34:2: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
           strcpy(dg00x->card->shortname, model);
           ^~~~~~
   sound/firewire/digi00x/digi00x.c:35:2: warning: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
           strcpy(dg00x->card->mixername, model);
           ^~~~~~
   sound/firewire/digi00x/digi00x.c:35:2: note: Call to function 'strcpy' is insecure as it does not provide bounding of the memory buffer. Replace unbounded copy functions with analogous functions that support length arguments such as 'strlcpy'. CWE-119
           strcpy(dg00x->card->mixername, model);
           ^~~~~~
   sound/firewire/digi00x/digi00x.c:36:2: warning: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11 [clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           snprintf(dg00x->card->longname, sizeof(dg00x->card->longname),
           ^~~~~~~~
   sound/firewire/digi00x/digi00x.c:36:2: note: Call to function 'snprintf' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'snprintf_s' in case of C11
           snprintf(dg00x->card->longname, sizeof(dg00x->card->longname),
           ^~~~~~~~
   Suppressed 8 warnings (8 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.
   9 warnings generated.
   Suppressed 9 warnings (9 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.
   15 warnings generated.
   Suppressed 15 warnings (15 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.
   12 warnings generated.
   drivers/usb/chipidea/otg_fsm.c:42:2: warning: Value stored to 'next' is never read [clang-analyzer-deadcode.DeadStores]
           next += t;
           ^       ~
   drivers/usb/chipidea/otg_fsm.c:42:2: note: Value stored to 'next' is never read
           next += t;
           ^       ~
   drivers/usb/chipidea/otg_fsm.c:91:2: warning: Value stored to 'next' is never read [clang-analyzer-deadcode.DeadStores]
           next += t;
           ^       ~
   drivers/usb/chipidea/otg_fsm.c:91:2: note: Value stored to 'next' is never read
           next += t;
           ^       ~
   drivers/usb/chipidea/otg_fsm.c:131:2: warning: Value stored to 'next' is never read [clang-analyzer-deadcode.DeadStores]
           next += t;
           ^       ~
   drivers/usb/chipidea/otg_fsm.c:131:2: note: Value stored to 'next' is never read
           next += t;
           ^       ~
   Suppressed 9 warnings (9 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.
   9 warnings generated.
   Suppressed 9 warnings (9 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.
   9 warnings generated.
   Suppressed 9 warnings (9 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.
   9 warnings generated.
   Suppressed 9 warnings (9 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.
   9 warnings generated.
   Suppressed 9 warnings (9 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.
   9 warnings generated.
   Suppressed 9 warnings (9 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.
   9 warnings generated.
   include/linux/list.h:137:13: warning: Use of memory after it is freed [clang-analyzer-unix.Malloc]
           __list_del(entry->prev, entry->next);
                      ^
   drivers/firmware/cirrus/cs_dsp.c:2338:2: note: Loop condition is false. Execution continues on line 2341
           list_for_each_entry(ctl, &dsp->ctl_list, list)
           ^
   include/linux/list.h:638:2: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
           ^
   drivers/firmware/cirrus/cs_dsp.c:2341:2: note: Calling 'cs_dsp_free_alg_regions'
           cs_dsp_free_alg_regions(dsp);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/firmware/cirrus/cs_dsp.c:1616:2: note: Loop condition is true.  Entering loop body
           while (!list_empty(&dsp->alg_regions)) {
           ^
   drivers/firmware/cirrus/cs_dsp.c:1621:3: note: Memory is released
                   kfree(alg_region);

vim +12 drivers/clocksource/timer-goldfish.c

c92e7ef16400bf Laurent Vivier 2022-04-06  11  
c92e7ef16400bf Laurent Vivier 2022-04-06 @12  struct goldfish_timer {
c92e7ef16400bf Laurent Vivier 2022-04-06  13  	struct clocksource cs;
c92e7ef16400bf Laurent Vivier 2022-04-06  14  	struct clock_event_device ced;
c92e7ef16400bf Laurent Vivier 2022-04-06  15  	struct resource res;
c92e7ef16400bf Laurent Vivier 2022-04-06  16  	void __iomem *base;
c92e7ef16400bf Laurent Vivier 2022-04-06  17  };
c92e7ef16400bf Laurent Vivier 2022-04-06  18  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

             reply	other threads:[~2023-01-25  0:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-25  0:03 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-03-20  2:50 drivers/clocksource/timer-goldfish.c:12:8: warning: Excessive padding in 'struct goldfish_timer' (96 padding bytes, where 32 is optimal). Optimal fields order: ced, base, res, cs, consider reordering the fields or adding explicit padding members [clang-an kernel test robot
2022-11-22 19:13 kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202301250740.FHUsJmnq-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=oe-kbuild@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.