All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: drivers/iio/potentiometer/ad5110.c:59:8: warning: Excessive padding in 'struct ad5110_data' (59 padding bytes, where 27 is optimal).
Date: Sun, 21 Nov 2021 13:36:59 +0800	[thread overview]
Message-ID: <202111211348.fb4QJdxY-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 14297 bytes --]

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Mugilraj Dhavachelvan <dmugil2000@gmail.com>
CC: Jonathan Cameron <Jonathan.Cameron@huawei.com>
CC: Andy Shevchenko <andy.shevchenko@gmail.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   923dcc5eb0c111eccd51cc7ce1658537e3c38b25
commit: d03a74bfaccefcf271bf8e889c31229aa521cd66 iio: potentiometer: Add driver support for AD5110
date:   3 months ago
:::::: branch date: 8 hours ago
:::::: commit date: 3 months ago
config: arm-randconfig-c002-20210928 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project dc6e8dfdfe7efecfda318d43a06fae18b40eb498)
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=d03a74bfaccefcf271bf8e889c31229aa521cd66
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout d03a74bfaccefcf271bf8e889c31229aa521cd66
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm clang-analyzer 

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


clang-analyzer warnings: (new ones prefixed by >>)
                   if (first_hole != blocks_per_page) {
                       ^~~~~~~~~~
   fs/ext4/readpage.c:339:3: note: Taking false branch
                   if (first_hole != blocks_per_page) {
                   ^
   fs/ext4/readpage.c:350:14: note: 'fully_mapped' is 1
                   } else if (fully_mapped) {
                              ^~~~~~~~~~~~
   fs/ext4/readpage.c:350:10: note: Taking true branch
                   } else if (fully_mapped) {
                          ^
   fs/ext4/readpage.c:353:7: note: 'fully_mapped' is 1
                   if (fully_mapped && blocks_per_page == 1 &&
                       ^~~~~~~~~~~~
   fs/ext4/readpage.c:353:7: note: Left side of '&&' is true
   fs/ext4/readpage.c:353:23: note: 'blocks_per_page' is not equal to 1
                   if (fully_mapped && blocks_per_page == 1 &&
                                       ^~~~~~~~~~~~~~~
   fs/ext4/readpage.c:353:44: note: Left side of '&&' is false
                   if (fully_mapped && blocks_per_page == 1 &&
                                                            ^
   fs/ext4/readpage.c:363:7: note: 'bio' is null
                   if (bio && (last_block_in_bio != blocks[0] - 1 ||
                       ^~~
   fs/ext4/readpage.c:363:11: note: Left side of '&&' is false
                   if (bio && (last_block_in_bio != blocks[0] - 1 ||
                           ^
   fs/ext4/readpage.c:369:7: note: 'bio' is equal to NULL
                   if (bio == NULL) {
                       ^~~
   fs/ext4/readpage.c:369:3: note: Taking true branch
                   if (bio == NULL) {
                   ^
   fs/ext4/readpage.c:378:4: note: Assuming 'bdev' is equal to field 'bi_bdev'
                           bio_set_dev(bio, bdev);
                           ^
   include/linux/bio.h:492:6: note: expanded from macro 'bio_set_dev'
           if ((bio)->bi_bdev != (bdev))                   \
               ^~~~~~~~~~~~~~~~~~~~~~~~
   fs/ext4/readpage.c:378:4: note: Taking false branch
                           bio_set_dev(bio, bdev);
                           ^
   include/linux/bio.h:492:2: note: expanded from macro 'bio_set_dev'
           if ((bio)->bi_bdev != (bdev))                   \
           ^
   fs/ext4/readpage.c:378:4: note: Loop condition is false.  Exiting loop
                           bio_set_dev(bio, bdev);
                           ^
   include/linux/bio.h:489:36: note: expanded from macro 'bio_set_dev'
   #define bio_set_dev(bio, bdev)                          \
                                                           ^
   fs/ext4/readpage.c:379:39: note: The left operand of '<<' is a garbage value
                           bio->bi_iter.bi_sector = blocks[0] << (blkbits - 9);
                                                    ~~~~~~~~~ ^
   include/asm-generic/bitops/non-atomic.h:106:16: warning: Array access (from variable 'addr') results in a null pointer dereference [clang-analyzer-core.NullDereference]
           return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
                         ^
   fs/ext4/readpage.c:243:26: note: Assuming 'rac' is non-null
           unsigned int nr_pages = rac ? readahead_count(rac) : 1;
                                   ^~~
   fs/ext4/readpage.c:243:26: note: '?' condition is true
   fs/ext4/readpage.c:250:2: note: Loop condition is true.  Entering loop body
           for (; nr_pages; nr_pages--) {
           ^
   fs/ext4/readpage.c:254:7: note: 'rac' is non-null
                   if (rac) {
                       ^~~
   fs/ext4/readpage.c:254:3: note: Taking true branch
                   if (rac) {
                   ^
   fs/ext4/readpage.c:259:7: note: Calling 'PagePrivate'
                   if (page_has_buffers(page))
                       ^
   include/linux/buffer_head.h:146:32: note: expanded from macro 'page_has_buffers'
   #define page_has_buffers(page)  PagePrivate(page)
                                   ^~~~~~~~~~~~~~~~~
   include/linux/page-flags.h:369:1: note: Passing null pointer value via 2nd parameter 'addr'
   PAGEFLAG(Private, private, PF_ANY)
   ^
   include/linux/page-flags.h:294:2: note: expanded from macro 'PAGEFLAG'
           TESTPAGEFLAG(uname, lname, policy)                              \
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/page-flags.h:267:32: note: expanded from macro 'TESTPAGEFLAG'
           { return test_bit(PG_##lname, &policy(page, 0)->flags); }
                                         ^~~~~~~~~~~~~~~~~~~~~~~
   include/linux/page-flags.h:369:1: note: Calling 'test_bit'
   PAGEFLAG(Private, private, PF_ANY)
   ^
   include/linux/page-flags.h:294:2: note: expanded from macro 'PAGEFLAG'
           TESTPAGEFLAG(uname, lname, policy)                              \
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/page-flags.h:267:11: note: expanded from macro 'TESTPAGEFLAG'
           { return test_bit(PG_##lname, &policy(page, 0)->flags); }
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/asm-generic/bitops/non-atomic.h:106:16: note: Array access (from variable 'addr') results in a null pointer dereference
           return 1UL & (addr[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG-1)));
                         ^~~~
   Suppressed 10 warnings (10 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/iio/potentiometer/ad5110.c:59:8: warning: Excessive padding in 'struct ad5110_data' (59 padding bytes, where 27 is optimal). 
   Optimal fields order: 
   buf, 
   tol, 
   client, 
   cfg, 
   lock, 
   enable, 
   consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
   struct ad5110_data {
   ~~~~~~~^~~~~~~~~~~~~
   drivers/iio/potentiometer/ad5110.c:59:8: note: Excessive padding in 'struct ad5110_data' (59 padding bytes, where 27 is optimal). Optimal fields order: buf, tol, client, cfg, lock, enable, consider reordering the fields or adding explicit padding members
   struct ad5110_data {
   ~~~~~~~^~~~~~~~~~~~~
   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.
   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.
   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/iio/pressure/dlhl60d.c:45:8: warning: Excessive padding in 'struct dlh_state' (52 padding bytes, where 20 is optimal). 
   Optimal fields order: 
   rx_buf, 
   use_interrupt, 
   client, 
   info, 
   completion, 
   consider reordering the fields or adding explicit padding members [clang-analyzer-optin.performance.Padding]
   struct dlh_state {
   ~~~~~~~^~~~~~~~~~~
   drivers/iio/pressure/dlhl60d.c:45:8: note: Excessive padding in 'struct dlh_state' (52 padding bytes, where 20 is optimal). Optimal fields order: rx_buf, use_interrupt, client, info, completion, consider reordering the fields or adding explicit padding members
   struct dlh_state {
   ~~~~~~~^~~~~~~~~~~
   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.
   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.
   11 warnings generated.
   drivers/iio/pressure/icp10100.c:264:15: warning: 1st function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
           *pressure = (be16_to_cpu(measures[0]) << 8) |
                        ^
   include/linux/byteorder/generic.h:97:21: note: expanded from macro 'be16_to_cpu'
   #define be16_to_cpu __be16_to_cpu
                       ^
   include/uapi/linux/byteorder/little_endian.h:42:26: note: expanded from macro '__be16_to_cpu'
   #define __be16_to_cpu(x) __swab16((__force __u16)(__be16)(x))
                            ^
   include/uapi/linux/swab.h:102:28: note: expanded from macro '__swab16'
   #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
                              ^
   drivers/iio/pressure/icp10100.c:383:2: note: Control jumps to 'case IIO_CHAN_INFO_PROCESSED:' @line 385
           switch (mask) {
           ^
   drivers/iio/pressure/icp10100.c:386:10: note: Calling 'icp10100_read_raw_measures'
                   return icp10100_read_raw_measures(indio_dev, chan, val, val2);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/pressure/icp10100.c:347:6: note: Assuming 'ret' is 0
           if (ret)
               ^~~
   drivers/iio/pressure/icp10100.c:347:2: note: Taking false branch
           if (ret)
           ^
   drivers/iio/pressure/icp10100.c:350:8: note: Calling 'icp10100_get_measures'
           ret = icp10100_get_measures(st, &raw_pressure, &raw_temp);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/pressure/icp10100.c:254:6: note: 'ret' is >= 0
           if (ret < 0)
               ^~~
   drivers/iio/pressure/icp10100.c:254:2: note: Taking false branch
           if (ret < 0)
           ^
   drivers/iio/pressure/icp10100.c:259:8: note: Calling 'icp10100_send_cmd'
           ret = icp10100_send_cmd(st, cmd, measures, sizeof(measures));
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/pressure/icp10100.c:145:6: note: Assuming the condition is false
           if (size > sizeof(data))
               ^~~~~~~~~~~~~~~~~~~
   drivers/iio/pressure/icp10100.c:145:2: note: Taking false branch
           if (size > sizeof(data))
           ^
   drivers/iio/pressure/icp10100.c:148:6: note: Assuming field 'response_word_nb' is <= 0
           if (cmd->response_word_nb > 0 &&
               ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/pressure/icp10100.c:148:32: note: Left side of '&&' is false
           if (cmd->response_word_nb > 0 &&
                                         ^
   drivers/iio/pressure/icp10100.c:152:2: note: Taking false branch
           dev_dbg(&st->client->dev, "sending cmd %#x\n", be16_to_cpu(cmd->cmd));
           ^
   include/linux/dev_printk.h:123:2: note: expanded from macro 'dev_dbg'
           dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
           ^
   include/linux/dynamic_debug.h:166:2: note: expanded from macro 'dynamic_dev_dbg'
           _dynamic_func_call(fmt,__dynamic_dev_dbg,               \
           ^
   include/linux/dynamic_debug.h:152:2: note: expanded from macro '_dynamic_func_call'
           __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)

vim +59 drivers/iio/potentiometer/ad5110.c

d03a74bfaccefc Mugilraj Dhavachelvan 2021-08-14  58  
d03a74bfaccefc Mugilraj Dhavachelvan 2021-08-14 @59  struct ad5110_data {
d03a74bfaccefc Mugilraj Dhavachelvan 2021-08-14  60  	struct i2c_client       *client;
d03a74bfaccefc Mugilraj Dhavachelvan 2021-08-14  61  	s16			tol;		/* resistor tolerance */
d03a74bfaccefc Mugilraj Dhavachelvan 2021-08-14  62  	bool			enable;
d03a74bfaccefc Mugilraj Dhavachelvan 2021-08-14  63  	struct mutex            lock;
d03a74bfaccefc Mugilraj Dhavachelvan 2021-08-14  64  	const struct ad5110_cfg	*cfg;
d03a74bfaccefc Mugilraj Dhavachelvan 2021-08-14  65  	/*
d03a74bfaccefc Mugilraj Dhavachelvan 2021-08-14  66  	 * DMA (thus cache coherency maintenance) requires the
d03a74bfaccefc Mugilraj Dhavachelvan 2021-08-14  67  	 * transfer buffers to live in their own cache lines.
d03a74bfaccefc Mugilraj Dhavachelvan 2021-08-14  68  	 */
d03a74bfaccefc Mugilraj Dhavachelvan 2021-08-14  69  	u8			buf[2] ____cacheline_aligned;
d03a74bfaccefc Mugilraj Dhavachelvan 2021-08-14  70  };
d03a74bfaccefc Mugilraj Dhavachelvan 2021-08-14  71  

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 36056 bytes --]

                 reply	other threads:[~2021-11-21  5:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=202111211348.fb4QJdxY-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /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.