All of lore.kernel.org
 help / color / mirror / Atom feed
* sound/soc/qcom/qdsp6/audioreach.c:500:36: warning: Division by zero [clang-analyzer-core.DivideZero]
@ 2022-02-01 21:43 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2022-02-01 21:43 UTC (permalink / raw)
  To: kbuild

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

CC: llvm(a)lists.linux.dev
CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
CC: Mark Brown <broonie@kernel.org>
CC: "Pierre-Louis Bossart" <pierre-louis.bossart@linux.intel.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   26291c54e111ff6ba87a164d85d4a4e134b7315c
commit: cf989b68fcadbeeea1446e50fd8b2f24a0f1275c ASoC: qdsp6: audioreach: add Kconfig and Makefile
date:   3 months ago
:::::: branch date: 2 days ago
:::::: commit date: 3 months ago
config: arm-randconfig-c002-20220122 (https://download.01.org/0day-ci/archive/20220202/202202020521.tgUIFWYr-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 7b3d30728816403d1fd73cc5082e9fb761262bce)
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=cf989b68fcadbeeea1446e50fd8b2f24a0f1275c
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout cf989b68fcadbeeea1446e50fd8b2f24a0f1275c
        # 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 >>)
   include/linux/printk.h:417:3: note: expanded from macro 'printk_index_wrap'
                   __printk_index_emit(_fmt, NULL, NULL);                  \
                   ^
   include/linux/printk.h:392:34: note: expanded from macro '__printk_index_emit'
   #define __printk_index_emit(...) do {} while (0)
                                    ^
   drivers/mtd/tests/subpagetest.c:348:14: note: Assuming 'i' is >= 'ebcnt'
           for (i = 0; i < ebcnt; ++i) {
                       ^~~~~~~~~
   drivers/mtd/tests/subpagetest.c:348:2: note: Loop condition is false. Execution continues on line 361
           for (i = 0; i < ebcnt; ++i) {
           ^
   drivers/mtd/tests/subpagetest.c:361:2: note: Loop condition is false.  Exiting loop
           pr_info("verified %u eraseblocks\n", i);
           ^
   include/linux/printk.h:519:2: note: expanded from macro 'pr_info'
           printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
           ^
   include/linux/printk.h:446:26: note: expanded from macro 'printk'
   #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
                            ^
   include/linux/printk.h:417:3: note: expanded from macro 'printk_index_wrap'
                   __printk_index_emit(_fmt, NULL, NULL);                  \
                   ^
   include/linux/printk.h:392:34: note: expanded from macro '__printk_index_emit'
   #define __printk_index_emit(...) do {} while (0)
                                    ^
   drivers/mtd/tests/subpagetest.c:364:6: note: Assuming 'err' is 0
           if (err)
               ^~~
   drivers/mtd/tests/subpagetest.c:364:2: note: Taking false branch
           if (err)
           ^
   drivers/mtd/tests/subpagetest.c:367:8: note: Calling 'verify_all_eraseblocks_ff'
           err = verify_all_eraseblocks_ff();
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/mtd/tests/subpagetest.c:250:2: note: Loop condition is false.  Exiting loop
           pr_info("verifying all eraseblocks for 0xff\n");
           ^
   include/linux/printk.h:519:2: note: expanded from macro 'pr_info'
           printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
           ^
   include/linux/printk.h:446:26: note: expanded from macro 'printk'
   #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
                            ^
   include/linux/printk.h:417:3: note: expanded from macro 'printk_index_wrap'
                   __printk_index_emit(_fmt, NULL, NULL);                  \
                   ^
   include/linux/printk.h:392:34: note: expanded from macro '__printk_index_emit'
   #define __printk_index_emit(...) do {} while (0)
                                    ^
   drivers/mtd/tests/subpagetest.c:251:14: note: Assuming 'i' is < 'ebcnt'
           for (i = 0; i < ebcnt; ++i) {
                       ^~~~~~~~~
   drivers/mtd/tests/subpagetest.c:251:2: note: Loop condition is true.  Entering loop body
           for (i = 0; i < ebcnt; ++i) {
           ^
   drivers/mtd/tests/subpagetest.c:252:7: note: Assuming the condition is false
                   if (bbt[i])
                       ^~~~~~
   drivers/mtd/tests/subpagetest.c:252:3: note: Taking false branch
                   if (bbt[i])
                   ^
   drivers/mtd/tests/subpagetest.c:254:9: note: Calling 'verify_eraseblock_ff'
                   err = verify_eraseblock_ff(i);
                         ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/mtd/tests/subpagetest.c:220:14: note: Assuming the condition is true
           for (j = 0; j < mtd->erasesize / subpgsize; ++j) {
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/mtd/tests/subpagetest.c:220:2: note: Loop condition is true.  Entering loop body
           for (j = 0; j < mtd->erasesize / subpgsize; ++j) {
           ^
   drivers/mtd/tests/subpagetest.c:222:9: note: Value assigned to 'subpgsize'
                   err = mtd_read(mtd, addr, subpgsize, &read, readbuf);
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/mtd/tests/subpagetest.c:223:16: note: Assuming 'err' is 0
                   if (unlikely(err || read != subpgsize)) {
                                ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   drivers/mtd/tests/subpagetest.c:223:16: note: Left side of '||' is false
                   if (unlikely(err || read != subpgsize)) {
                                ^
   drivers/mtd/tests/subpagetest.c:223:23: note: Assuming 'read' is equal to 'subpgsize'
                   if (unlikely(err || read != subpgsize)) {
                                       ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   drivers/mtd/tests/subpagetest.c:223:3: note: Taking false branch
                   if (unlikely(err || read != subpgsize)) {
                   ^
   drivers/mtd/tests/subpagetest.c:234:3: note: Taking false branch
                   if (unlikely(memcmp(readbuf, writebuf, subpgsize))) {
                   ^
   drivers/mtd/tests/subpagetest.c:220:33: note: Division by zero
           for (j = 0; j < mtd->erasesize / subpgsize; ++j) {
                           ~~~~~~~~~~~~~~~^~~~~~~~~~~
   2 warnings generated.
>> sound/soc/qcom/qdsp6/audioreach.c:500:36: warning: Division by zero [clang-analyzer-core.DivideZero]
           num_modules_per_list = num_modules/num_containers;
                                  ~~~~~~~~~~~^~~~~~~~~~~~~~~
   sound/soc/qcom/qdsp6/audioreach.c:480:2: note: 'num_containers' initialized to 0
           int num_containers = 0;
           ^~~~~~~~~~~~~~~~~~
   sound/soc/qcom/qdsp6/audioreach.c:487:2: note: Left side of '&&' is false
           list_for_each_entry(sgs, sg_list, node) {
           ^
   include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                      ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/kernel.h:495:61: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                                                                      ^
   sound/soc/qcom/qdsp6/audioreach.c:487:2: note: Taking false branch
           list_for_each_entry(sgs, sg_list, node) {
           ^
   include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                      ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:302:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   sound/soc/qcom/qdsp6/audioreach.c:487:2: note: Loop condition is false.  Exiting loop
           list_for_each_entry(sgs, sg_list, node) {
           ^
   include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                      ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:300:2: note: expanded from macro '__compiletime_assert'
           do {                                                            \
           ^
   sound/soc/qcom/qdsp6/audioreach.c:487:2: note: Loop condition is false. Execution continues on line 499
           list_for_each_entry(sgs, sg_list, node) {
           ^
   include/linux/list.h:628:2: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
           ^
   sound/soc/qcom/qdsp6/audioreach.c:500:36: note: Division by zero
           num_modules_per_list = num_modules/num_containers;
                                  ~~~~~~~~~~~^~~~~~~~~~~~~~~
>> sound/soc/qcom/qdsp6/audioreach.c:558:2: warning: Value stored to 'p' is never read [clang-analyzer-deadcode.DeadStores]
           p += mc_sz;
           ^    ~~~~~
   sound/soc/qcom/qdsp6/audioreach.c:558:2: note: Value stored to 'p' is never read
           p += mc_sz;
           ^    ~~~~~
   1 warning generated.
   drivers/iio/chemical/bme680_core.c:741:2: warning: Value stored to 'ret' is never read [clang-analyzer-deadcode.DeadStores]
           ret = regmap_read(data->regmap, BME680_REG_MEAS_STAT_0, &check);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/chemical/bme680_core.c:741:2: note: Value stored to 'ret' is never read
           ret = regmap_read(data->regmap, BME680_REG_MEAS_STAT_0, &check);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   2 warnings generated.
   sound/drivers/mpu401/mpu401.c:67: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(card->shortname, card->driver);
           ^~~~~~
   sound/drivers/mpu401/mpu401.c:67: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(card->shortname, card->driver);
           ^~~~~~
   sound/drivers/mpu401/mpu401.c:72:3: warning: Call to function 'strcat' 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 'strlcat'. CWE-119 [clang-analyzer-security.insecureAPI.strcpy]
                   strcat(card->longname, "polled");
                   ^~~~~~
   sound/drivers/mpu401/mpu401.c:72:3: note: Call to function 'strcat' 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 'strlcat'. CWE-119
                   strcat(card->longname, "polled");
                   ^~~~~~
   5 warnings generated.
   include/linux/list.h:86:2: warning: Use of memory after it is freed [clang-analyzer-unix.Malloc]
           __list_add(new, head, head->next);
           ^
   sound/pci/hda/hda_codec.c:270:9: note: Calling 'snd_hda_get_conn_list'
           nums = snd_hda_get_conn_list(codec, mux, &conn);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/pci/hda/hda_codec.c:173:2: note: Loop condition is true.  Entering loop body
           for (;;) {
           ^
   sound/pci/hda/hda_codec.c:179:7: note: 'p' is null
                   if (p) {
                       ^
   sound/pci/hda/hda_codec.c:179:3: note: Taking false branch
                   if (p) {
                   ^
   sound/pci/hda/hda_codec.c:184:3: note: Taking false branch
                   if (snd_BUG_ON(added))
                   ^
   sound/pci/hda/hda_codec.c:187:9: note: Calling 'read_and_add_raw_conns'
                   err = read_and_add_raw_conns(codec, nid);
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/pci/hda/hda_codec.c:139:6: note: Assuming the condition is false
           if (len == -ENOSPC) {
               ^~~~~~~~~~~~~~
   sound/pci/hda/hda_codec.c:139:2: note: Taking false branch
           if (len == -ENOSPC) {
           ^
   sound/pci/hda/hda_codec.c:146:6: note: Assuming 'len' is >= 0
           if (len >= 0)
               ^~~~~~~~
   sound/pci/hda/hda_codec.c:146:2: note: Taking true branch
           if (len >= 0)
           ^
   sound/pci/hda/hda_codec.c:147:9: note: Calling 'snd_hda_override_conn_list'
                   len = snd_hda_override_conn_list(codec, nid, len, result);
                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/pci/hda/hda_codec.c:244:6: note: 'p' is non-null
           if (p) {
               ^
   sound/pci/hda/hda_codec.c:244:2: note: Taking true branch
           if (p) {
           ^
   sound/pci/hda/hda_codec.c:246:3: note: Memory is released
                   kfree(p);
                   ^~~~~~~~
   sound/pci/hda/hda_codec.c:249:9: note: Calling 'add_conn_list'
           return add_conn_list(codec, nid, len, list);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   sound/pci/hda/hda_codec.c:112:6: note: Assuming 'p' is non-null
           if (!p)
               ^~
   sound/pci/hda/hda_codec.c:112:2: note: Taking false branch
           if (!p)
           ^
   sound/pci/hda/hda_codec.c:117:2: note: Calling 'list_add'
           list_add(&p->list, &codec->conn_list);
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:86:2: note: Use of memory after it is freed
           __list_add(new, head, head->next);
           ^                     ~~~~~~~~~~
   include/linux/list.h:135:13: warning: Use of memory after it is freed [clang-analyzer-unix.Malloc]
           __list_del(entry->prev, entry->next);
                      ^
   sound/pci/hda/hda_codec.c:765:6: note: Assuming field 'registered' is 0
           if (codec->registered) {
               ^~~~~~~~~~~~~~~~~
   sound/pci/hda/hda_codec.c:765:2: note: Taking false branch
           if (codec->registered) {
           ^
   sound/pci/hda/hda_codec.c:773:6: note: Assuming field 'in_freeing' is not equal to 0
           if (!codec->in_freeing)
               ^~~~~~~~~~~~~~~~~~
   sound/pci/hda/hda_codec.c:773:2: note: Taking false branch
           if (!codec->in_freeing)
--
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
           ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:300:2: note: expanded from macro '__compiletime_assert'
           do {                                                            \
           ^
   sound/pci/hda/hda_codec.c:127:3: note: Memory is released
                   kfree(p);
                   ^~~~~~~~
   sound/pci/hda/hda_codec.c:123:2: note: Loop condition is true.  Entering loop body
           while (!list_empty(&codec->conn_list)) {
           ^
   sound/pci/hda/hda_codec.c:125:7: note: Left side of '&&' is false
                   p = list_first_entry(&codec->conn_list, typeof(*p), list);
                       ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/kernel.h:495:61: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                                                                      ^
   sound/pci/hda/hda_codec.c:125:7: note: Taking false branch
                   p = list_first_entry(&codec->conn_list, typeof(*p), list);
                       ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
           ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:302:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   sound/pci/hda/hda_codec.c:125:7: note: Loop condition is false.  Exiting loop
                   p = list_first_entry(&codec->conn_list, typeof(*p), list);
                       ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/kernel.h:495:2: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
           ^
   note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:300:2: note: expanded from macro '__compiletime_assert'
           do {                                                            \
           ^
   sound/pci/hda/hda_codec.c:126:3: note: Calling 'list_del'
                   list_del(&p->list);
                   ^~~~~~~~~~~~~~~~~~
   include/linux/list.h:147:14: note: Use of memory after it is freed
           entry->next = LIST_POISON1;
           ~~~~~~~~~~~ ^
   sound/pci/hda/hda_codec.c:1613: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(id.name, name);
           ^~~~~~
   sound/pci/hda/hda_codec.c:1613: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(id.name, name);
           ^~~~~~
   sound/pci/hda/hda_codec.c:3465: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(uinfo->value.enumerated.name, imux->items[index].label);
           ^~~~~~
   sound/pci/hda/hda_codec.c:3465: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(uinfo->value.enumerated.name, imux->items[index].label);
           ^~~~~~
   2 warnings generated.
>> sound/soc/qcom/qdsp6/audioreach.c:500:36: warning: Division by zero [clang-analyzer-core.DivideZero]
           num_modules_per_list = num_modules/num_containers;
                                  ~~~~~~~~~~~^~~~~~~~~~~~~~~
   sound/soc/qcom/qdsp6/audioreach.c:480:2: note: 'num_containers' initialized to 0
           int num_containers = 0;
           ^~~~~~~~~~~~~~~~~~
   sound/soc/qcom/qdsp6/audioreach.c:487:2: note: Left side of '&&' is false
           list_for_each_entry(sgs, sg_list, node) {
           ^
   include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                      ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/kernel.h:495:61: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                                                                      ^
   sound/soc/qcom/qdsp6/audioreach.c:487:2: note: Taking false branch
           list_for_each_entry(sgs, sg_list, node) {
           ^
   include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                      ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:302:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   sound/soc/qcom/qdsp6/audioreach.c:487:2: note: Loop condition is false.  Exiting loop
           list_for_each_entry(sgs, sg_list, node) {
           ^
   include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                      ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:300:2: note: expanded from macro '__compiletime_assert'
           do {                                                            \
           ^
   sound/soc/qcom/qdsp6/audioreach.c:487:2: note: Loop condition is false. Execution continues on line 499
           list_for_each_entry(sgs, sg_list, node) {
           ^
   include/linux/list.h:628:2: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
           ^
   sound/soc/qcom/qdsp6/audioreach.c:500:36: note: Division by zero
           num_modules_per_list = num_modules/num_containers;
                                  ~~~~~~~~~~~^~~~~~~~~~~~~~~
>> sound/soc/qcom/qdsp6/audioreach.c:558:2: warning: Value stored to 'p' is never read [clang-analyzer-deadcode.DeadStores]
           p += mc_sz;
           ^    ~~~~~
   sound/soc/qcom/qdsp6/audioreach.c:558:2: note: Value stored to 'p' is never read
           p += mc_sz;
           ^    ~~~~~
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   1 warning generated.
   drivers/rtc/rtc-mc146818-lib.c:187:3: warning: Value stored to 'century' is never read [clang-analyzer-deadcode.DeadStores]
                   century = bin2bcd(century);
                   ^
   drivers/rtc/rtc-mc146818-lib.c:187:3: note: Value stored to 'century' is never read
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   2 warnings generated.
   net/bluetooth/hci_core.c:2188: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(di.name, hdev->name);
           ^~~~~~
   net/bluetooth/hci_core.c:2188: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(di.name, hdev->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.
   5 warnings generated.
   net/bluetooth/mgmt.c:6265:4: warning: Value stored to 'authenticated' is never read [clang-analyzer-deadcode.DeadStores]
                           authenticated = 0x00;
                           ^               ~~~~
   net/bluetooth/mgmt.c:6265:4: note: Value stored to 'authenticated' is never read
                           authenticated = 0x00;
                           ^               ~~~~
   net/bluetooth/mgmt.c:6266:4: warning: Value stored to 'type' is never read [clang-analyzer-deadcode.DeadStores]
                           type = SMP_LTK_P256_DEBUG;
                           ^      ~~~~~~~~~~~~~~~~~~
   net/bluetooth/mgmt.c:6266:4: note: Value stored to 'type' is never read
                           type = SMP_LTK_P256_DEBUG;
                           ^      ~~~~~~~~~~~~~~~~~~
   net/bluetooth/mgmt.c:7239:2: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
           err = mgmt_limited_event(MGMT_EV_LOCAL_OOB_DATA_UPDATED, hdev,
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/bluetooth/mgmt.c:7239:2: note: Value stored to 'err' is never read
           err = mgmt_limited_event(MGMT_EV_LOCAL_OOB_DATA_UPDATED, hdev,
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/bluetooth/mgmt.c:7590:14: warning: Although the value stored to 'cur_len' is used in the enclosing expression, the value is never actually read from 'cur_len' [clang-analyzer-deadcode.DeadStores]
           for (i = 0, cur_len = 0; i < len; i += (cur_len + 1)) {
                       ^         ~
   net/bluetooth/mgmt.c:7590:14: note: Although the value stored to 'cur_len' is used in the enclosing expression, the value is never actually read from 'cur_len'
           for (i = 0, cur_len = 0; i < len; i += (cur_len + 1)) {
                       ^         ~
   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/net/phy/at803x.c:356:3: warning: Value stored to 'value' is never read [clang-analyzer-deadcode.DeadStores]
                   value = phy_read(phydev, AT803X_INTR_STATUS);
                   ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/phy/at803x.c:356:3: note: Value stored to 'value' is never read
                   value = phy_read(phydev, AT803X_INTR_STATUS);
                   ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/phy/at803x.c:363:3: warning: Value stored to 'value' is never read [clang-analyzer-deadcode.DeadStores]
                   value = phy_read(phydev, AT803X_INTR_STATUS);
                   ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/phy/at803x.c:363:3: note: Value stored to 'value' is never read
                   value = phy_read(phydev, AT803X_INTR_STATUS);
                   ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning generated.
   drivers/net/phy/bcm-cygnus.c:70:2: warning: Value stored to 'rc' is never read [clang-analyzer-deadcode.DeadStores]
           rc = bcm_phy_write_exp_sel(phydev, MII_BRCM_CORE_EXPB0, 0x00);
           ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/phy/bcm-cygnus.c:70:2: note: Value stored to 'rc' is never read
           rc = bcm_phy_write_exp_sel(phydev, MII_BRCM_CORE_EXPB0, 0x00);
           ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning generated.
   drivers/net/phy/marvell.c:1222:2: warning: Value stored to 'err' is never read [clang-analyzer-deadcode.DeadStores]
           err = genphy_config_aneg(phydev);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/net/phy/marvell.c:1222:2: note: Value stored to 'err' is never read
           err = genphy_config_aneg(phydev);
           ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning generated.
   drivers/comedi/drivers/das08.c:181:2: warning: Value stored to 'range' is never read [clang-analyzer-deadcode.DeadStores]
           range = CR_RANGE(insn->chanspec);
           ^
   drivers/comedi/drivers/das08.c:181:2: note: Value stored to 'range' is never read
   2 warnings generated.
   drivers/fsi/fsi-scom.c:295:7: warning: 2nd function call argument is an uninitialized value [clang-analyzer-core.CallAndMessage]
           rc = handle_fsi2pib_status(scom, status);
                ^
   drivers/fsi/fsi-scom.c:360:6: note: Assuming the condition is false
           if (len != sizeof(uint64_t))
               ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/fsi/fsi-scom.c:360:2: note: Taking false branch
           if (len != sizeof(uint64_t))
           ^
   drivers/fsi/fsi-scom.c:364:6: note: 'rc' is 0
           if (rc) {

vim +500 sound/soc/qcom/qdsp6/audioreach.c

5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  464  
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  465  void *audioreach_alloc_graph_pkt(struct q6apm *apm, struct list_head *sg_list, int graph_id)
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  466  {
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  467  	int payload_size, sg_sz, cont_sz, ml_sz, mp_sz, mc_sz;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  468  	struct apm_module_param_data  *param_data;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  469  	struct apm_container_params *cont_params;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  470  	struct audioreach_container *container;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  471  	struct apm_sub_graph_params *sg_params;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  472  	struct apm_mod_conn_list_params *mcon;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  473  	struct apm_graph_open_params params;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  474  	struct apm_prop_list_params *mprop;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  475  	struct audioreach_module *module;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  476  	struct audioreach_sub_graph *sgs;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  477  	struct apm_mod_list_obj *mlobj;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  478  	int num_modules_per_list;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  479  	int num_connections = 0;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  480  	int num_containers = 0;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  481  	int num_sub_graphs = 0;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  482  	int num_modules = 0;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  483  	int num_modules_list;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  484  	struct gpr_pkt *pkt;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  485  	void *p;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  486  
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26 @487  	list_for_each_entry(sgs, sg_list, node) {
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  488  		num_sub_graphs++;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  489  		list_for_each_entry(container, &sgs->container_list, node) {
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  490  			num_containers++;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  491  			num_modules += container->num_modules;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  492  			list_for_each_container_module(module, container) {
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  493  				if (module->src_mod_inst_id)
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  494  					num_connections++;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  495  			}
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  496  		}
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  497  	}
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  498  
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  499  	num_modules_list = num_containers;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26 @500  	num_modules_per_list = num_modules/num_containers;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  501  	sg_sz = APM_SUB_GRAPH_PSIZE(sg_params, num_sub_graphs);
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  502  	cont_sz = APM_CONTAINER_PSIZE(cont_params, num_containers);
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  503  	ml_sz =	ALIGN(sizeof(struct apm_module_list_params) +
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  504  		num_modules_list * APM_MOD_LIST_OBJ_PSIZE(mlobj,  num_modules_per_list), 8);
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  505  	mp_sz = APM_MOD_PROP_PSIZE(mprop, num_modules);
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  506  	mc_sz =	APM_MOD_CONN_PSIZE(mcon, num_connections);
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  507  
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  508  	payload_size = sg_sz + cont_sz + ml_sz + mp_sz + mc_sz;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  509  	pkt = audioreach_alloc_apm_cmd_pkt(payload_size, APM_CMD_GRAPH_OPEN, 0);
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  510  	if (IS_ERR(pkt))
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  511  		return pkt;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  512  
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  513  	p = (void *)pkt + GPR_HDR_SIZE + APM_CMD_HDR_SIZE;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  514  
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  515  	/* SubGraph */
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  516  	params.sg_data = p;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  517  	param_data = &params.sg_data->param_data;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  518  	param_data->module_instance_id = APM_MODULE_INSTANCE_ID;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  519  	param_data->param_id = APM_PARAM_ID_SUB_GRAPH_CONFIG;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  520  	param_data->param_size = sg_sz - APM_MODULE_PARAM_DATA_SIZE;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  521  	params.sg_data->num_sub_graphs = num_sub_graphs;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  522  	p += sg_sz;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  523  
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  524  	/* Container */
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  525  	params.cont_data = p;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  526  	param_data = &params.cont_data->param_data;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  527  	param_data->module_instance_id = APM_MODULE_INSTANCE_ID;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  528  	param_data->param_id = APM_PARAM_ID_CONTAINER_CONFIG;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  529  	param_data->param_size = cont_sz - APM_MODULE_PARAM_DATA_SIZE;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  530  	params.cont_data->num_containers = num_containers;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  531  	p += cont_sz;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  532  
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  533  	/* Module List*/
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  534  	params.mod_list_data = p;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  535  	param_data = &params.mod_list_data->param_data;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  536  	param_data->module_instance_id = APM_MODULE_INSTANCE_ID;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  537  	param_data->param_id = APM_PARAM_ID_MODULE_LIST;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  538  	param_data->param_size = ml_sz - APM_MODULE_PARAM_DATA_SIZE;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  539  	params.mod_list_data->num_modules_list = num_sub_graphs;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  540  	p += ml_sz;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  541  
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  542  	/* Module Properties */
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  543  	params.mod_prop_data = p;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  544  	param_data = &params.mod_prop_data->param_data;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  545  	param_data->module_instance_id = APM_MODULE_INSTANCE_ID;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  546  	param_data->param_id = APM_PARAM_ID_MODULE_PROP;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  547  	param_data->param_size = mp_sz - APM_MODULE_PARAM_DATA_SIZE;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  548  	params.mod_prop_data->num_modules_prop_cfg = num_modules;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  549  	p += mp_sz;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  550  
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  551  	/* Module Connections */
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  552  	params.mod_conn_list_data = p;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  553  	param_data = &params.mod_conn_list_data->param_data;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  554  	param_data->module_instance_id = APM_MODULE_INSTANCE_ID;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  555  	param_data->param_id = APM_PARAM_ID_MODULE_CONN;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  556  	param_data->param_size = mc_sz - APM_MODULE_PARAM_DATA_SIZE;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  557  	params.mod_conn_list_data->num_connections = num_connections;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26 @558  	p += mc_sz;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  559  
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  560  	audioreach_populate_graph(&params, sg_list, num_sub_graphs);
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  561  
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  562  	return pkt;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  563  }
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  564  EXPORT_SYMBOL_GPL(audioreach_alloc_graph_pkt);
25ab80db6b133c2 Srinivas Kandagatla 2021-10-26  565  

:::::: The code at line 500 was first introduced by commit
:::::: 5477518b8a0e8a45239646acd80c9bafc4401522 ASoC: qdsp6: audioreach: add q6apm support

:::::: TO: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
:::::: CC: Mark Brown <broonie@kernel.org>

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

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

* sound/soc/qcom/qdsp6/audioreach.c:500:36: warning: Division by zero [clang-analyzer-core.DivideZero]
@ 2022-04-18  8:51 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2022-04-18  8:51 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 27227 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: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
CC: Mark Brown <broonie@kernel.org>
CC: "Pierre-Louis Bossart" <pierre-louis.bossart@linux.intel.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   b2d229d4ddb17db541098b83524d901257e93845
commit: cf989b68fcadbeeea1446e50fd8b2f24a0f1275c ASoC: qdsp6: audioreach: add Kconfig and Makefile
date:   6 months ago
:::::: branch date: 12 hours ago
:::::: commit date: 6 months ago
config: arm-randconfig-c002-20220417 (https://download.01.org/0day-ci/archive/20220418/202204181618.SMd6OlsI-lkp(a)intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 64c045e25b8471bbb572bd29159c294a82a86a25)
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=cf989b68fcadbeeea1446e50fd8b2f24a0f1275c
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout cf989b68fcadbeeea1446e50fd8b2f24a0f1275c
        # 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 >>)
               ^~~~~~~~~~~~~~~~~~~~~
   drivers/iio/industrialio-buffer.c:796:2: note: Taking false branch
           if (compound_mask == NULL)
           ^
   drivers/iio/industrialio-buffer.c:801:2: note: Left side of '&&' is false
           list_for_each_entry(buffer, &iio_dev_opaque->buffer_list, buffer_list) {
           ^
   include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                      ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/kernel.h:495:61: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                                                                      ^
   drivers/iio/industrialio-buffer.c:801:2: note: Taking false branch
           list_for_each_entry(buffer, &iio_dev_opaque->buffer_list, buffer_list) {
           ^
   include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                      ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:302:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   drivers/iio/industrialio-buffer.c:801:2: note: Loop condition is false.  Exiting loop
           list_for_each_entry(buffer, &iio_dev_opaque->buffer_list, buffer_list) {
           ^
   include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                      ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:300:2: note: expanded from macro '__compiletime_assert'
           do {                                                            \
           ^
   drivers/iio/industrialio-buffer.c:801:22: note: Value assigned to 'buffer'
           list_for_each_entry(buffer, &iio_dev_opaque->buffer_list, buffer_list) {
                               ^
   include/linux/list.h:628:7: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/industrialio-buffer.c:801:2: note: Loop condition is true.  Entering loop body
           list_for_each_entry(buffer, &iio_dev_opaque->buffer_list, buffer_list) {
           ^
   include/linux/list.h:628:2: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
           ^
   drivers/iio/industrialio-buffer.c:802:7: note: Assuming 'buffer' is equal to 'remove_buffer'
                   if (buffer == remove_buffer)
                       ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/industrialio-buffer.c:802:3: note: Taking true branch
                   if (buffer == remove_buffer)
                   ^
   drivers/iio/industrialio-buffer.c:803:4: note:  Execution continues on line 801
                           continue;
                           ^
   drivers/iio/industrialio-buffer.c:801:2: note: Dereference of null pointer
           list_for_each_entry(buffer, &iio_dev_opaque->buffer_list, buffer_list) {
           ^
   include/linux/list.h:630:13: note: expanded from macro 'list_for_each_entry'
                pos = list_next_entry(pos, member))
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:555:2: note: expanded from macro 'list_next_entry'
           list_entry((pos)->member.next, typeof(*(pos)), member)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:494:25: note: expanded from macro 'container_of'
           void *__mptr = (void *)(ptr);                                   \
                                  ^~~~~
   2 warnings generated.
>> sound/soc/qcom/qdsp6/audioreach.c:500:36: warning: Division by zero [clang-analyzer-core.DivideZero]
           num_modules_per_list = num_modules/num_containers;
                                  ~~~~~~~~~~~^~~~~~~~~~~~~~~
   sound/soc/qcom/qdsp6/audioreach.c:480:2: note: 'num_containers' initialized to 0
           int num_containers = 0;
           ^~~~~~~~~~~~~~~~~~
   sound/soc/qcom/qdsp6/audioreach.c:487:2: note: Left side of '&&' is false
           list_for_each_entry(sgs, sg_list, node) {
           ^
   include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                      ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   include/linux/kernel.h:495:61: note: expanded from macro 'container_of'
           BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) &&   \
                                                                      ^
   sound/soc/qcom/qdsp6/audioreach.c:487:2: note: Taking false branch
           list_for_each_entry(sgs, sg_list, node) {
           ^
   include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                      ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:302:3: note: expanded from macro '__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   sound/soc/qcom/qdsp6/audioreach.c:487:2: note: Loop condition is false.  Exiting loop
           list_for_each_entry(sgs, sg_list, node) {
           ^
   include/linux/list.h:628:13: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
                      ^
   include/linux/list.h:522:2: note: expanded from macro 'list_first_entry'
           list_entry((ptr)->next, type, member)
           ^
   include/linux/list.h:511:2: note: expanded from macro 'list_entry'
           container_of(ptr, type, member)
           ^
   note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/compiler_types.h:322:2: note: expanded from macro 'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
           ^
   include/linux/compiler_types.h:310:2: note: expanded from macro '_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:300:2: note: expanded from macro '__compiletime_assert'
           do {                                                            \
           ^
   sound/soc/qcom/qdsp6/audioreach.c:487:2: note: Loop condition is false. Execution continues on line 499
           list_for_each_entry(sgs, sg_list, node) {
           ^
   include/linux/list.h:628:2: note: expanded from macro 'list_for_each_entry'
           for (pos = list_first_entry(head, typeof(*pos), member);        \
           ^
   sound/soc/qcom/qdsp6/audioreach.c:500:36: note: Division by zero
           num_modules_per_list = num_modules/num_containers;
                                  ~~~~~~~~~~~^~~~~~~~~~~~~~~
>> sound/soc/qcom/qdsp6/audioreach.c:558:2: warning: Value stored to 'p' is never read [clang-analyzer-deadcode.DeadStores]
           p += mc_sz;
           ^    ~~~~~
   sound/soc/qcom/qdsp6/audioreach.c:558:2: note: Value stored to 'p' is never read
           p += mc_sz;
           ^    ~~~~~
   1 warning generated.
   Suppressed 1 warnings (1 with check filters).
   2 warnings generated.
   Suppressed 2 warnings (1 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.
   3 warnings generated.
   net/sched/sch_fq_codel.c:196:11: warning: The left operand of '&' is a garbage value [clang-analyzer-core.UndefinedBinaryOperatorResult]
                   if (ret & __NET_XMIT_BYPASS)
                       ~~~ ^
   net/sched/sch_fq_codel.c:190:2: note: 'ret' declared without an initial value
           int ret;
           ^~~~~~~
   net/sched/sch_fq_codel.c:194:8: note: Calling 'fq_codel_classify'
           idx = fq_codel_classify(skb, sch, &ret);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   net/sched/sch_fq_codel.c:84:6: note: Assuming the condition is false
           if (TC_H_MAJ(skb->priority) == sch->handle &&
               ^
   include/uapi/linux/pkt_sched.h:70:21: note: expanded from macro 'TC_H_MAJ'
   #define TC_H_MAJ(h) ((h)&TC_H_MAJ_MASK)
                       ^
   net/sched/sch_fq_codel.c:84:45: note: Left side of '&&' is false
           if (TC_H_MAJ(skb->priority) == sch->handle &&
                                                      ^
   net/sched/sch_fq_codel.c:89:11: note: Left side of '||' is false
           filter = rcu_dereference_bh(q->filter_list);
                    ^
   include/linux/rcupdate.h:604:31: note: expanded from macro 'rcu_dereference_bh'
   #define rcu_dereference_bh(p) rcu_dereference_bh_check(p, 0)
                                 ^
   include/linux/rcupdate.h:543:2: note: expanded from macro 'rcu_dereference_bh_check'
           __rcu_dereference_check((p), (c) || rcu_read_lock_bh_held(), __rcu)
           ^
   include/linux/rcupdate.h:389:48: note: expanded from macro '__rcu_dereference_check'
           typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \
                                                         ^
   include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
           compiletime_assert_rwonce_type(x);                              \
           ^
   include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
           compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
                              ^
   include/linux/compiler_types.h:290:3: note: expanded from macro '__native_word'
           (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
            ^
   net/sched/sch_fq_codel.c:89:11: note: Left side of '||' is false
           filter = rcu_dereference_bh(q->filter_list);
                    ^
   include/linux/rcupdate.h:604:31: note: expanded from macro 'rcu_dereference_bh'
   #define rcu_dereference_bh(p) rcu_dereference_bh_check(p, 0)
                                 ^
   include/linux/rcupdate.h:543:2: note: expanded from macro 'rcu_dereference_bh_check'
           __rcu_dereference_check((p), (c) || rcu_read_lock_bh_held(), __rcu)
           ^
   include/linux/rcupdate.h:389:48: note: expanded from macro '__rcu_dereference_check'
           typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \
                                                         ^
   include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
           compiletime_assert_rwonce_type(x);                              \
           ^
   include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
           compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
                              ^
   include/linux/compiler_types.h:290:3: note: expanded from macro '__native_word'
           (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
            ^
   net/sched/sch_fq_codel.c:89:11: note: Left side of '||' is true
           filter = rcu_dereference_bh(q->filter_list);
                    ^
   include/linux/rcupdate.h:604:31: note: expanded from macro 'rcu_dereference_bh'
   #define rcu_dereference_bh(p) rcu_dereference_bh_check(p, 0)
                                 ^
   include/linux/rcupdate.h:543:2: note: expanded from macro 'rcu_dereference_bh_check'
           __rcu_dereference_check((p), (c) || rcu_read_lock_bh_held(), __rcu)
           ^
   include/linux/rcupdate.h:389:48: note: expanded from macro '__rcu_dereference_check'
           typeof(*p) *________p1 = (typeof(*p) *__force)READ_ONCE(p); \
                                                         ^
   include/asm-generic/rwonce.h:49:2: note: expanded from macro 'READ_ONCE'
           compiletime_assert_rwonce_type(x);                              \
           ^
   include/asm-generic/rwonce.h:36:21: note: expanded from macro 'compiletime_assert_rwonce_type'
           compiletime_assert(__native_word(t) || sizeof(t) == sizeof(long long),  \
                              ^
   include/linux/compiler_types.h:291:28: note: expanded from macro '__native_word'
            sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
                                     ^
   net/sched/sch_fq_codel.c:89:11: note: Taking false branch
           filter = rcu_dereference_bh(q->filter_list);
                    ^
   include/linux/rcupdate.h:604:31: note: expanded from macro 'rcu_dereference_bh'
   #define rcu_dereference_bh(p) rcu_dereference_bh_check(p, 0)
                                 ^
   include/linux/rcupdate.h:543:2: note: expanded from macro 'rcu_dereference_bh_check'
           __rcu_dereference_check((p), (c) || rcu_read_lock_bh_held(), __rcu)

vim +500 sound/soc/qcom/qdsp6/audioreach.c

5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  464  
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  465  void *audioreach_alloc_graph_pkt(struct q6apm *apm, struct list_head *sg_list, int graph_id)
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  466  {
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  467  	int payload_size, sg_sz, cont_sz, ml_sz, mp_sz, mc_sz;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  468  	struct apm_module_param_data  *param_data;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  469  	struct apm_container_params *cont_params;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  470  	struct audioreach_container *container;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  471  	struct apm_sub_graph_params *sg_params;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  472  	struct apm_mod_conn_list_params *mcon;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  473  	struct apm_graph_open_params params;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  474  	struct apm_prop_list_params *mprop;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  475  	struct audioreach_module *module;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  476  	struct audioreach_sub_graph *sgs;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  477  	struct apm_mod_list_obj *mlobj;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  478  	int num_modules_per_list;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  479  	int num_connections = 0;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  480  	int num_containers = 0;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  481  	int num_sub_graphs = 0;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  482  	int num_modules = 0;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  483  	int num_modules_list;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  484  	struct gpr_pkt *pkt;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  485  	void *p;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  486  
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26 @487  	list_for_each_entry(sgs, sg_list, node) {
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  488  		num_sub_graphs++;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  489  		list_for_each_entry(container, &sgs->container_list, node) {
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  490  			num_containers++;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  491  			num_modules += container->num_modules;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  492  			list_for_each_container_module(module, container) {
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  493  				if (module->src_mod_inst_id)
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  494  					num_connections++;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  495  			}
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  496  		}
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  497  	}
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  498  
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  499  	num_modules_list = num_containers;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26 @500  	num_modules_per_list = num_modules/num_containers;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  501  	sg_sz = APM_SUB_GRAPH_PSIZE(sg_params, num_sub_graphs);
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  502  	cont_sz = APM_CONTAINER_PSIZE(cont_params, num_containers);
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  503  	ml_sz =	ALIGN(sizeof(struct apm_module_list_params) +
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  504  		num_modules_list * APM_MOD_LIST_OBJ_PSIZE(mlobj,  num_modules_per_list), 8);
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  505  	mp_sz = APM_MOD_PROP_PSIZE(mprop, num_modules);
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  506  	mc_sz =	APM_MOD_CONN_PSIZE(mcon, num_connections);
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  507  
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  508  	payload_size = sg_sz + cont_sz + ml_sz + mp_sz + mc_sz;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  509  	pkt = audioreach_alloc_apm_cmd_pkt(payload_size, APM_CMD_GRAPH_OPEN, 0);
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  510  	if (IS_ERR(pkt))
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  511  		return pkt;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  512  
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  513  	p = (void *)pkt + GPR_HDR_SIZE + APM_CMD_HDR_SIZE;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  514  
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  515  	/* SubGraph */
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  516  	params.sg_data = p;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  517  	param_data = &params.sg_data->param_data;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  518  	param_data->module_instance_id = APM_MODULE_INSTANCE_ID;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  519  	param_data->param_id = APM_PARAM_ID_SUB_GRAPH_CONFIG;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  520  	param_data->param_size = sg_sz - APM_MODULE_PARAM_DATA_SIZE;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  521  	params.sg_data->num_sub_graphs = num_sub_graphs;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  522  	p += sg_sz;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  523  
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  524  	/* Container */
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  525  	params.cont_data = p;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  526  	param_data = &params.cont_data->param_data;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  527  	param_data->module_instance_id = APM_MODULE_INSTANCE_ID;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  528  	param_data->param_id = APM_PARAM_ID_CONTAINER_CONFIG;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  529  	param_data->param_size = cont_sz - APM_MODULE_PARAM_DATA_SIZE;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  530  	params.cont_data->num_containers = num_containers;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  531  	p += cont_sz;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  532  
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  533  	/* Module List*/
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  534  	params.mod_list_data = p;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  535  	param_data = &params.mod_list_data->param_data;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  536  	param_data->module_instance_id = APM_MODULE_INSTANCE_ID;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  537  	param_data->param_id = APM_PARAM_ID_MODULE_LIST;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  538  	param_data->param_size = ml_sz - APM_MODULE_PARAM_DATA_SIZE;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  539  	params.mod_list_data->num_modules_list = num_sub_graphs;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  540  	p += ml_sz;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  541  
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  542  	/* Module Properties */
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  543  	params.mod_prop_data = p;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  544  	param_data = &params.mod_prop_data->param_data;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  545  	param_data->module_instance_id = APM_MODULE_INSTANCE_ID;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  546  	param_data->param_id = APM_PARAM_ID_MODULE_PROP;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  547  	param_data->param_size = mp_sz - APM_MODULE_PARAM_DATA_SIZE;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  548  	params.mod_prop_data->num_modules_prop_cfg = num_modules;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  549  	p += mp_sz;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  550  
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  551  	/* Module Connections */
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  552  	params.mod_conn_list_data = p;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  553  	param_data = &params.mod_conn_list_data->param_data;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  554  	param_data->module_instance_id = APM_MODULE_INSTANCE_ID;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  555  	param_data->param_id = APM_PARAM_ID_MODULE_CONN;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  556  	param_data->param_size = mc_sz - APM_MODULE_PARAM_DATA_SIZE;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  557  	params.mod_conn_list_data->num_connections = num_connections;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26 @558  	p += mc_sz;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  559  
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  560  	audioreach_populate_graph(&params, sg_list, num_sub_graphs);
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  561  
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  562  	return pkt;
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  563  }
5477518b8a0e8a4 Srinivas Kandagatla 2021-10-26  564  EXPORT_SYMBOL_GPL(audioreach_alloc_graph_pkt);
25ab80db6b133c2 Srinivas Kandagatla 2021-10-26  565  

:::::: The code at line 500 was first introduced by commit
:::::: 5477518b8a0e8a45239646acd80c9bafc4401522 ASoC: qdsp6: audioreach: add q6apm support

:::::: TO: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
:::::: CC: Mark Brown <broonie@kernel.org>

-- 
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-04-18  8:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-01 21:43 sound/soc/qcom/qdsp6/audioreach.c:500:36: warning: Division by zero [clang-analyzer-core.DivideZero] kernel test robot
2022-04-18  8:51 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.