All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/iio/test/iio-test-rescale.c:578: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-...
@ 2022-03-29 21:51 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2022-03-29 21:51 UTC (permalink / raw)
  To: kbuild

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

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Liam Beguin <liambeguin@gmail.com>
CC: Jonathan Cameron <Jonathan.Cameron@huawei.com>
CC: Peter Rosin <peda@axentia.se>
CC: Andy Shevchenko <andy.shevchenko@gmail.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   1930a6e739c4b4a654a69164dbe39e554d228915
commit: 8e74a48d17d509bf605e64252f38550b1a9cc376 iio: test: add basic tests for the iio-rescale driver
date:   4 weeks ago
:::::: branch date: 21 hours ago
:::::: commit date: 4 weeks ago
config: arm-randconfig-c002-20220328 (https://download.01.org/0day-ci/archive/20220330/202203300527.sDzBjoh9-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0f6d9501cf49ce02937099350d08f20c4af86f3d)
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=8e74a48d17d509bf605e64252f38550b1a9cc376
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 8e74a48d17d509bf605e64252f38550b1a9cc376
        # save the config file 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 >>)
                           ^
   fs/xfs/libxfs/xfs_defer.c:499:9: note: Left side of '||' is false
           while (!list_empty(&dop_pending) || !list_empty(&(*tp)->t_dfops)) {
                  ^
   fs/xfs/libxfs/xfs_defer.c:499:2: note: Loop condition is true.  Entering loop body
           while (!list_empty(&dop_pending) || !list_empty(&(*tp)->t_dfops)) {
           ^
   fs/xfs/libxfs/xfs_defer.c:513:7: note: 'error' is 0
                   if (error)
                       ^~~~~
   fs/xfs/libxfs/xfs_defer.c:513:3: note: Taking false branch
                   if (error)
                   ^
   fs/xfs/libxfs/xfs_defer.c:518:7: note: 'error' is 0
                   if (error)
                       ^~~~~
   fs/xfs/libxfs/xfs_defer.c:518:3: note: Taking false branch
                   if (error)
                   ^
   fs/xfs/libxfs/xfs_defer.c:523:11: note: Calling 'xfs_defer_finish_one'
                   error = xfs_defer_finish_one(*tp, dfp);
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/xfs/libxfs/xfs_defer.c:442:2: note: 'error' declared without an initial value
           int                             error;
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/xfs/libxfs/xfs_defer.c:447:2: note: Loop condition is false. Execution continues on line 470
           list_for_each_safe(li, n, &dfp->dfp_work) {
           ^
   include/linux/list.h:607:2: note: expanded from macro 'list_for_each_safe'
           for (pos = (head)->next, n = pos->next; \
           ^
   fs/xfs/libxfs/xfs_defer.c:473:6: note: Assuming field 'finish_cleanup' is null
           if (ops->finish_cleanup)
               ^~~~~~~~~~~~~~~~~~~
   fs/xfs/libxfs/xfs_defer.c:473:2: note: Taking false branch
           if (ops->finish_cleanup)
           ^
   fs/xfs/libxfs/xfs_defer.c:475:2: note: Undefined or garbage value returned to caller
           return error;
           ^      ~~~~~
   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.
   7 warnings generated.
   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.
   8 warnings generated.
   fs/jfs/jfs_types.h:61:33: warning: The left operand of '&' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
           pxd->len_addr = (pxd->len_addr & cpu_to_le32(~0xffffff)) |
                                          ^
   fs/jfs/inode.c:211:6: note: Assuming 'create' is not equal to 0
           if (create)
               ^~~~~~
   fs/jfs/inode.c:211:2: note: Taking true branch
           if (create)
           ^
   fs/jfs/inode.c:216:7: note: Assuming the condition is true
           if (((lblock64 << ip->i_sb->s_blocksize_bits) < ip->i_size) &&
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/jfs/inode.c:216:6: note: Left side of '&&' is true
           if (((lblock64 << ip->i_sb->s_blocksize_bits) < ip->i_size) &&
               ^
   fs/jfs/inode.c:217:7: note: Assuming the condition is true
               (!xtLookup(ip, lblock64, xlen, &xflag, &xaddr, &xlen, 0)) &&
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/jfs/inode.c:216:6: note: Left side of '&&' is true
           if (((lblock64 << ip->i_sb->s_blocksize_bits) < ip->i_size) &&
               ^
   fs/jfs/inode.c:218:6: note: Assuming 'xaddr' is not equal to 0
               xaddr) {
               ^~~~~
   fs/jfs/inode.c:216:2: note: Taking true branch
           if (((lblock64 << ip->i_sb->s_blocksize_bits) < ip->i_size) &&
           ^
   fs/jfs/inode.c:219:7: note: Assuming the condition is true
                   if (xflag & XAD_NOTRECORDED) {
                       ^~~~~~~~~~~~~~~~~~~~~~~
   fs/jfs/inode.c:219:3: note: Taking true branch
                   if (xflag & XAD_NOTRECORDED) {
                   ^
   fs/jfs/inode.c:220:9: note: 'create' is not equal to 0
                           if (!create)
                                ^~~~~~
   fs/jfs/inode.c:220:4: note: Taking false branch
                           if (!create)
                           ^
   fs/jfs/inode.c:228:4: note: Calling 'PXDlength'
                           XADlength(&xad, xlen);
                           ^
   fs/jfs/jfs_xtree.h:38:34: note: expanded from macro 'XADlength'
   #define XADlength(xad, length32) PXDlength(&(xad)->loc, length32)
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   fs/jfs/jfs_types.h:61:33: note: The left operand of '&' is a garbage value
           pxd->len_addr = (pxd->len_addr & cpu_to_le32(~0xffffff)) |
                            ~~~~~~~~~~~~~ ^
   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.
   2 warnings generated.
>> drivers/iio/test/iio-test-rescale.c:578: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(desc, t->name);
           ^~~~~~
   drivers/iio/test/iio-test-rescale.c:578: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(desc, t->name);
           ^~~~~~
   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.
   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.
   7 warnings generated.
   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.
   12 warnings generated.
   drivers/perf/arm-cmn.c:1252:25: warning: Value stored to 'nid' during its initialization is never read [clang-analyzer-deadcode.DeadStores]
                   struct arm_cmn_nodeid nid = arm_cmn_nid(cmn, nodeid);
                                         ^~~   ~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/perf/arm-cmn.c:1252:25: note: Value stored to 'nid' during its initialization is never read
                   struct arm_cmn_nodeid nid = arm_cmn_nid(cmn, nodeid);
                                         ^~~   ~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/perf/arm-cmn.c:1635:3: warning: Value stored to 'level' is never read [clang-analyzer-deadcode.DeadStores]
                   level = 0;
                   ^       ~
   drivers/perf/arm-cmn.c:1635:3: note: Value stored to 'level' is never read
                   level = 0;
                   ^       ~
   drivers/perf/arm-cmn.c:1637:3: warning: Value stored to 'level' is never read [clang-analyzer-deadcode.DeadStores]
                   level = 1;
                   ^       ~
   drivers/perf/arm-cmn.c:1637:3: note: Value stored to 'level' is never read
                   level = 1;
                   ^       ~
   drivers/perf/arm-cmn.c:1639:3: warning: Value stored to 'level' is never read [clang-analyzer-deadcode.DeadStores]
                   level = 2;
                   ^       ~
   drivers/perf/arm-cmn.c:1639:3: note: Value stored to 'level' is never read
                   level = 2;
                   ^       ~
   drivers/perf/arm-cmn.c:1823:29: warning: Division by zero [clang-analyzer-core.DivideZero]
           cmn->mesh_y = cmn->num_xps / cmn->mesh_x;
                         ~~~~~~~~~~~~~^~~~~~~~~~~~~
   drivers/perf/arm-cmn.c:1657:2: note: Calling 'arm_cmn_init_node_info'
           arm_cmn_init_node_info(cmn, rgn_offset, &cfg);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/perf/arm-cmn.c:1628:15: note: Taking false branch
           node->type = FIELD_GET(CMN_NI_NODE_TYPE, reg);
                        ^
   include/linux/bitfield.h:125:3: note: expanded from macro 'FIELD_GET'
                   __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: ");       \
                   ^
   include/linux/bitfield.h:62:3: note: expanded from macro '__BF_FIELD_CHECK'
                   BUILD_BUG_ON_MSG(!__builtin_constant_p(_mask),          \
                   ^
   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:346:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:334:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:326:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   drivers/perf/arm-cmn.c:1628:15: note: Loop condition is false.  Exiting loop
           node->type = FIELD_GET(CMN_NI_NODE_TYPE, reg);
                        ^
   include/linux/bitfield.h:125:3: note: expanded from macro 'FIELD_GET'
                   __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: ");       \
                   ^
   include/linux/bitfield.h:62:3: note: expanded from macro '__BF_FIELD_CHECK'
                   BUILD_BUG_ON_MSG(!__builtin_constant_p(_mask),          \
                   ^
   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:346:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:334:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:318:2: note: expanded from macro '__compiletime_assert'
           do {                                                            \
           ^
   drivers/perf/arm-cmn.c:1628:15: note: Taking false branch
           node->type = FIELD_GET(CMN_NI_NODE_TYPE, reg);
                        ^
   include/linux/bitfield.h:125:3: note: expanded from macro 'FIELD_GET'
                   __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: ");       \
                   ^
   include/linux/bitfield.h:64:3: note: expanded from macro '__BF_FIELD_CHECK'
                   BUILD_BUG_ON_MSG((_mask) == 0, _pfx "mask is zero");    \

vim +578 drivers/iio/test/iio-test-rescale.c

8e74a48d17d509 Liam Beguin 2022-02-12  575  
8e74a48d17d509 Liam Beguin 2022-02-12  576  static void case_to_desc(const struct rescale_tc_data *t, char *desc)
8e74a48d17d509 Liam Beguin 2022-02-12  577  {
8e74a48d17d509 Liam Beguin 2022-02-12 @578  	strcpy(desc, t->name);
8e74a48d17d509 Liam Beguin 2022-02-12  579  }
8e74a48d17d509 Liam Beguin 2022-02-12  580  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 2+ messages in thread

* drivers/iio/test/iio-test-rescale.c:578: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-...
@ 2022-05-01 10:13 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2022-05-01 10:13 UTC (permalink / raw)
  To: kbuild

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

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-kernel(a)vger.kernel.org
TO: Liam Beguin <liambeguin@gmail.com>
CC: Jonathan Cameron <Jonathan.Cameron@huawei.com>
CC: Peter Rosin <peda@axentia.se>
CC: Andy Shevchenko <andy.shevchenko@gmail.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   57ae8a492116910bad2b3497ffe555b3a4b4180f
commit: 8e74a48d17d509bf605e64252f38550b1a9cc376 iio: test: add basic tests for the iio-rescale driver
date:   9 weeks ago
:::::: branch date: 17 hours ago
:::::: commit date: 9 weeks ago
config: arm-randconfig-c002-20220501 (https://download.01.org/0day-ci/archive/20220501/202205011807.KH8fN4zM-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 400775649969b9baf3bc2a510266e7912bb16ae9)
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=8e74a48d17d509bf605e64252f38550b1a9cc376
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 8e74a48d17d509bf605e64252f38550b1a9cc376
        # 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 as appropriate
Reported-by: kernel test robot <lkp@intel.com>


clang-analyzer warnings: (new ones prefixed by >>)
           BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
           ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:346:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:334:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:326:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   drivers/iio/proximity/sx9324.c:524:11: note: Loop condition is false.  Exiting loop
           regval = FIELD_GET(SX9324_REG_PROX_CTRL5_HYST_MASK, regval);
                    ^
   include/linux/bitfield.h:125:3: note: expanded from macro 'FIELD_GET'
                   __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: ");       \
                   ^
   include/linux/bitfield.h:71:3: note: expanded from macro '__BF_FIELD_CHECK'
                   __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) +                 \
                   ^
   include/linux/build_bug.h:21:2: note: expanded from macro '__BUILD_BUG_ON_NOT_POWER_OF_2'
           BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
           ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:346:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:334:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:318:2: note: expanded from macro '__compiletime_assert'
           do {                                                            \
           ^
   drivers/iio/proximity/sx9324.c:525:6: note: Assuming 'regval' is not equal to 0
           if (!regval)
               ^~~~~~~
   drivers/iio/proximity/sx9324.c:525:2: note: Taking false branch
           if (!regval)
           ^
   drivers/iio/proximity/sx9324.c:528:18: note: The left operand of '>>' is a garbage value
                   *val = pthresh >> (5 - regval);
                          ~~~~~~~ ^
   drivers/iio/proximity/sx9324.c:632:26: warning: The left operand of '>>' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
           else if (val >= pthresh >> 2)
                                   ^
   drivers/iio/proximity/sx9324.c:700:6: note: Assuming field 'type' is equal to IIO_PROXIMITY
           if (chan->type != IIO_PROXIMITY)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/proximity/sx9324.c:700:2: note: Taking false branch
           if (chan->type != IIO_PROXIMITY)
           ^
   drivers/iio/proximity/sx9324.c:703:2: note: Control jumps to 'case IIO_EV_INFO_HYSTERESIS:'  at line 715
           switch (info) {
           ^
   drivers/iio/proximity/sx9324.c:716:10: note: Calling 'sx9324_write_hysteresis'
                   return sx9324_write_hysteresis(data, chan, val);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/proximity/sx9324.c:624:11: note: 'pthresh' declared without an initial value
           int ret, pthresh;
                    ^~~~~~~
   drivers/iio/proximity/sx9324.c:626:8: note: Calling 'sx9324_read_thresh'
           ret = sx9324_read_thresh(data, chan, &pthresh);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/proximity/sx9324.c:499:6: note: Assuming 'ret' is not equal to 0
           if (ret)
               ^~~
   drivers/iio/proximity/sx9324.c:499:2: note: Taking true branch
           if (ret)
           ^
   drivers/iio/proximity/sx9324.c:500:3: note: Returning without writing to '*val'
                   return ret;
                   ^
   drivers/iio/proximity/sx9324.c:626:8: note: Returning from 'sx9324_read_thresh'
           ret = sx9324_read_thresh(data, chan, &pthresh);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/proximity/sx9324.c:627:6: note: Assuming 'ret' is >= 0
           if (ret < 0)
               ^~~~~~~
   drivers/iio/proximity/sx9324.c:627:2: note: Taking false branch
           if (ret < 0)
           ^
   drivers/iio/proximity/sx9324.c:630:6: note: Assuming 'val' is not equal to 0
           if (val == 0)
               ^~~~~~~~
   drivers/iio/proximity/sx9324.c:630:2: note: Taking false branch
           if (val == 0)
           ^
   drivers/iio/proximity/sx9324.c:632:26: note: The left operand of '>>' is a garbage value
           else if (val >= pthresh >> 2)
                           ~~~~~~~ ^
   drivers/iio/proximity/sx9324.c:868:3: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
                   ret = device_property_read_u32_array(dev, prop, pin_defs,
                   ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/proximity/sx9324.c:868:3: note: Value stored to 'ret' is never read
                   ret = device_property_read_u32_array(dev, prop, pin_defs,
                   ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   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.
   2 warnings generated.
>> drivers/iio/test/iio-test-rescale.c:578: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(desc, t->name);
           ^~~~~~
   drivers/iio/test/iio-test-rescale.c:578: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(desc, t->name);
           ^~~~~~
   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.
   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.
   2 warnings generated.
   drivers/perf/arm-cmn.c:1823:29: warning: Division by zero [clang-analyzer-core.DivideZero]
           cmn->mesh_y = cmn->num_xps / cmn->mesh_x;
                         ~~~~~~~~~~~~~^~~~~~~~~~~~~
   drivers/perf/arm-cmn.c:1657:2: note: Calling 'arm_cmn_init_node_info'
           arm_cmn_init_node_info(cmn, rgn_offset, &cfg);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/perf/arm-cmn.c:1628:15: note: Taking false branch
           node->type = FIELD_GET(CMN_NI_NODE_TYPE, reg);
                        ^
   include/linux/bitfield.h:125:3: note: expanded from macro 'FIELD_GET'
                   __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: ");       \
                   ^
   include/linux/bitfield.h:62:3: note: expanded from macro '__BF_FIELD_CHECK'
                   BUILD_BUG_ON_MSG(!__builtin_constant_p(_mask),          \
                   ^
   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:346:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:334:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:326:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   drivers/perf/arm-cmn.c:1628:15: note: Loop condition is false.  Exiting loop
           node->type = FIELD_GET(CMN_NI_NODE_TYPE, reg);
                        ^
   include/linux/bitfield.h:125:3: note: expanded from macro 'FIELD_GET'
                   __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: ");       \
                   ^
   include/linux/bitfield.h:62:3: note: expanded from macro '__BF_FIELD_CHECK'
                   BUILD_BUG_ON_MSG(!__builtin_constant_p(_mask),          \
                   ^
   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:346:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:334:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:318:2: note: expanded from macro '__compiletime_assert'
           do {                                                            \
           ^
   drivers/perf/arm-cmn.c:1628:15: note: Taking false branch
           node->type = FIELD_GET(CMN_NI_NODE_TYPE, reg);
                        ^
   include/linux/bitfield.h:125:3: note: expanded from macro 'FIELD_GET'
                   __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: ");       \
                   ^
   include/linux/bitfield.h:64:3: note: expanded from macro '__BF_FIELD_CHECK'
                   BUILD_BUG_ON_MSG((_mask) == 0, _pfx "mask is zero");    \
                   ^
   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:346:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:334:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:326:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   drivers/perf/arm-cmn.c:1628:15: note: Loop condition is false.  Exiting loop
           node->type = FIELD_GET(CMN_NI_NODE_TYPE, reg);
                        ^
   include/linux/bitfield.h:125:3: note: expanded from macro 'FIELD_GET'
                   __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: ");       \
                   ^
   include/linux/bitfield.h:64:3: note: expanded from macro '__BF_FIELD_CHECK'
                   BUILD_BUG_ON_MSG((_mask) == 0, _pfx "mask is zero");    \
                   ^
   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)

vim +578 drivers/iio/test/iio-test-rescale.c

8e74a48d17d509 Liam Beguin 2022-02-12  575  
8e74a48d17d509 Liam Beguin 2022-02-12  576  static void case_to_desc(const struct rescale_tc_data *t, char *desc)
8e74a48d17d509 Liam Beguin 2022-02-12  577  {
8e74a48d17d509 Liam Beguin 2022-02-12 @578  	strcpy(desc, t->name);
8e74a48d17d509 Liam Beguin 2022-02-12  579  }
8e74a48d17d509 Liam Beguin 2022-02-12  580  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-01 10:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-29 21:51 drivers/iio/test/iio-test-rescale.c:578: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- kernel test robot
2022-05-01 10:13 kernel test robot

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.