CC: [email protected]
CC: [email protected]
CC: [email protected]
TO: Takashi Iwai <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   6b75d88fa81b122cce37ebf17428a849ccd3d0f1
commit: 87e082ad84a7e1f022be168396ff1cb93a80c557 ALSA: cmipci: Allocate 
resources with device-managed APIs
date:   4 months ago
:::::: branch date: 10 hours ago
:::::: commit date: 4 months ago
config: i386-randconfig-c001-20211012 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 
c3dcf39554dbea780d6cb7e12239451ba47a2668)
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
        # 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=87e082ad84a7e1f022be168396ff1cb93a80c557
        git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 87e082ad84a7e1f022be168396ff1cb93a80c557
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=i386 
clang-analyzer 

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


clang-analyzer warnings: (new ones prefixed by >>)
   include/linux/stddef.h:8:14: note: expanded from macro 'NULL'
   #define NULL ((void *)0)
                ^~~~~~~~~~~
   drivers/gpu/drm/i915/gem/i915_gem_userptr.c:385:8: note: Calling 
'i915_gem_object_lock_interruptible'
           err = i915_gem_object_lock_interruptible(obj, NULL);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/gem/i915_gem_object.h:192:10: note: 'ww' is null
           WARN_ON(ww && !ww->intr);
                   ^
   drivers/gpu/drm/i915/i915_utils.h:48:26: note: expanded from macro 'WARN_ON'
   #define WARN_ON(x) WARN((x), "%s", "WARN_ON(" __stringify(x) ")")
                            ^
   include/asm-generic/bug.h:130:25: note: expanded from macro 'WARN'
           int __ret_warn_on = !!(condition);                              \
                                  ^~~~~~~~~
   drivers/gpu/drm/i915/gem/i915_gem_object.h:192:13: note: Left side of '&&' 
is false
           WARN_ON(ww && !ww->intr);
                      ^
   drivers/gpu/drm/i915/gem/i915_gem_object.h:192:2: note: Taking false branch
           WARN_ON(ww && !ww->intr);
           ^
   drivers/gpu/drm/i915/i915_utils.h:48:20: note: expanded from macro 'WARN_ON'
   #define WARN_ON(x) WARN((x), "%s", "WARN_ON(" __stringify(x) ")")
                      ^
   include/asm-generic/bug.h:131:2: note: expanded from macro 'WARN'
           if (unlikely(__ret_warn_on))                                    \
           ^
   drivers/gpu/drm/i915/gem/i915_gem_object.h:193:37: note: Passing null 
pointer value via 2nd parameter 'ww'
           return __i915_gem_object_lock(obj, ww, true);
                                              ^~
   drivers/gpu/drm/i915/gem/i915_gem_object.h:193:9: note: Calling 
'__i915_gem_object_lock'
           return __i915_gem_object_lock(obj, ww, true);
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/gem/i915_gem_object.h:167:6: note: 'intr' is true
           if (intr)
               ^~~~
   drivers/gpu/drm/i915/gem/i915_gem_object.h:167:2: note: Taking true branch
           if (intr)
           ^
   drivers/gpu/drm/i915/gem/i915_gem_object.h:168:53: note: 'ww' is null
                   ret = dma_resv_lock_interruptible(obj->base.resv, ww ? 
&ww->ctx : NULL);
                                                                     ^~
   drivers/gpu/drm/i915/gem/i915_gem_object.h:168:53: note: '?' condition is 
false
   drivers/gpu/drm/i915/gem/i915_gem_object.h:172:6: note: Assuming 'ret' is 
not equal to 0
           if (!ret && ww)
               ^~~~
   drivers/gpu/drm/i915/gem/i915_gem_object.h:172:11: note: Left side of '&&' 
is false
           if (!ret && ww)
                    ^
   drivers/gpu/drm/i915/gem/i915_gem_object.h:174:6: note: Assuming the 
condition is false
           if (ret == -EALREADY)
               ^~~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/gem/i915_gem_object.h:174:2: note: Taking false branch
           if (ret == -EALREADY)
           ^
   drivers/gpu/drm/i915/gem/i915_gem_object.h:177:6: note: Assuming the 
condition is true
           if (ret == -EDEADLK)
               ^~~~~~~~~~~~~~~
   drivers/gpu/drm/i915/gem/i915_gem_object.h:177:2: note: Taking true branch
           if (ret == -EDEADLK)
           ^
   drivers/gpu/drm/i915/gem/i915_gem_object.h:178:17: note: Access to field 
'contended' results in a dereference of a null pointer (loaded from variable 
'ww')
                   ww->contended = obj;
                   ~~            ^
   drivers/gpu/drm/i915/gem/i915_gem_userptr.c:320:11: warning: Although the 
value stored to 'ret' is used in the enclosing expression, the value is never 
actually read from 'ret' [clang-analyzer-deadcode.DeadStores]
           pinned = ret = 0;
                    ^     ~
   drivers/gpu/drm/i915/gem/i915_gem_userptr.c:320:11: note: Although the value 
stored to 'ret' is used in the enclosing expression, the value is never 
actually read from 'ret'
           pinned = ret = 0;
                    ^     ~
   Suppressed 9 warnings (9 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   10 warnings generated.
   sound/pci/azt3328.c:2109: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(pcm->name, chip->card->shortname);
           ^~~~~~
   sound/pci/azt3328.c:2109: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(pcm->name, chip->card->shortname);
           ^~~~~~
   sound/pci/azt3328.c:2126: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(pcm->name, chip->card->shortname);
           ^~~~~~
   sound/pci/azt3328.c:2126: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(pcm->name, chip->card->shortname);
           ^~~~~~
   Suppressed 8 warnings (7 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.
   10 warnings generated.
   sound/pci/cmipci.c:2742:3: 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(elem_id.name, cm_saved_mixer[idx].name);
                   ^~~~~~
   sound/pci/cmipci.c:2742:3: 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(elem_id.name, cm_saved_mixer[idx].name);
                   ^~~~~~
   sound/pci/cmipci.c:3036:3: 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(cm->card->driver + strlen(cm->card->driver), 
"-SWIEC");
                   ^~~~~~
   sound/pci/cmipci.c:3036:3: 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(cm->card->driver + strlen(cm->card->driver), 
"-SWIEC");
                   ^~~~~~
>> sound/pci/cmipci.c:3235:2: warning: Value stored to 'cm' is never read 
>> [clang-analyzer-deadcode.DeadStores]
           cm = card->private_data;
           ^    ~~~~~~~~~~~~~~~~~~
   sound/pci/cmipci.c:3235:2: note: Value stored to 'cm' is never read
           cm = card->private_data;
           ^    ~~~~~~~~~~~~~~~~~~
   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.
   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.
   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.
   9 warnings generated.
   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/virtio/virtio_ctl_msg.c:238:2: note: Loop condition is false.  Exiting 
loop
           spin_lock_irqsave(&queue->lock, flags);
           ^
   include/linux/spinlock.h:384:2: note: expanded from macro 'spin_lock_irqsave'
           raw_spin_lock_irqsave(spinlock_check(lock), flags);     \
           ^
   include/linux/spinlock.h:250:2: note: expanded from macro 
'raw_spin_lock_irqsave'
           do {                                            \
           ^
   sound/virtio/virtio_ctl_msg.c:238:2: note: Loop condition is false.  Exiting 
loop
           spin_lock_irqsave(&queue->lock, flags);
           ^
   include/linux/spinlock.h:382:43: note: expanded from macro 
'spin_lock_irqsave'
   #define spin_lock_irqsave(lock, flags)                          \
                                                                   ^
   sound/virtio/virtio_ctl_msg.c:239:2: note: Loop condition is true.  Entering 
loop body
           while (!list_empty(&snd->ctl_msgs)) {
           ^
   sound/virtio/virtio_ctl_msg.c:241:4: note: Left side of '&&' is false
                           list_first_entry(&snd->ctl_msgs, struct 
virtio_snd_msg,
                           ^
   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/virtio/virtio_ctl_msg.c:241:4: note: Taking false branch
                           list_first_entry(&snd->ctl_msgs, struct 
virtio_snd_msg,
                           ^
   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:328:2: note: expanded from macro 
'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, 
__COUNTER__)
           ^
   include/linux/compiler_types.h:316:2: note: expanded from macro 
'_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:308:3: note: expanded from macro 
'__compiletime_assert'
                   if (!(condition))                                       \
                   ^
   sound/virtio/virtio_ctl_msg.c:241:4: note: Loop condition is false.  Exiting 
loop
                           list_first_entry(&snd->ctl_msgs, struct 
virtio_snd_msg,
                           ^
   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:328:2: note: expanded from macro 
'compiletime_assert'
           _compiletime_assert(condition, msg, __compiletime_assert_, 
__COUNTER__)
           ^
   include/linux/compiler_types.h:316:2: note: expanded from macro 
'_compiletime_assert'
           __compiletime_assert(condition, msg, prefix, suffix)
           ^
   include/linux/compiler_types.h:306:2: note: expanded from macro 
'__compiletime_assert'
           do {                                                            \
           ^
   sound/virtio/virtio_ctl_msg.c:244:3: note: Calling 'virtsnd_ctl_msg_complete'
                   virtsnd_ctl_msg_complete(msg);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/cm +3235 sound/pci/cmipci.c

^1da177e4c3f41 Linus Torvalds 2005-04-16  3215  
e23e7a14362072 Bill Pemberton 2012-12-06  3216  static int 
snd_cmipci_probe(struct pci_dev *pci,
^1da177e4c3f41 Linus Torvalds 2005-04-16  3217                              
const struct pci_device_id *pci_id)
^1da177e4c3f41 Linus Torvalds 2005-04-16  3218  {
^1da177e4c3f41 Linus Torvalds 2005-04-16  3219          static int dev;
2cbdb686dd8df8 Takashi Iwai   2005-11-17  3220          struct snd_card *card;
2cbdb686dd8df8 Takashi Iwai   2005-11-17  3221          struct cmipci *cm;
^1da177e4c3f41 Linus Torvalds 2005-04-16  3222          int err;
^1da177e4c3f41 Linus Torvalds 2005-04-16  3223  
^1da177e4c3f41 Linus Torvalds 2005-04-16  3224          if (dev >= SNDRV_CARDS)
^1da177e4c3f41 Linus Torvalds 2005-04-16  3225                  return -ENODEV;
^1da177e4c3f41 Linus Torvalds 2005-04-16  3226          if (! enable[dev]) {
^1da177e4c3f41 Linus Torvalds 2005-04-16  3227                  dev++;
^1da177e4c3f41 Linus Torvalds 2005-04-16  3228                  return -ENOENT;
^1da177e4c3f41 Linus Torvalds 2005-04-16  3229          }
^1da177e4c3f41 Linus Torvalds 2005-04-16  3230  
87e082ad84a7e1 Takashi Iwai   2021-07-15  3231          err = 
snd_devm_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
87e082ad84a7e1 Takashi Iwai   2021-07-15  3232                                  
sizeof(*cm), &card);
e58de7baf7de11 Takashi Iwai   2008-12-28  3233          if (err < 0)
e58de7baf7de11 Takashi Iwai   2008-12-28  3234                  return err;
87e082ad84a7e1 Takashi Iwai   2021-07-15 @3235          cm = card->private_data;
^1da177e4c3f41 Linus Torvalds 2005-04-16  3236          
^1da177e4c3f41 Linus Torvalds 2005-04-16  3237          switch (pci->device) {
^1da177e4c3f41 Linus Torvalds 2005-04-16  3238          case 
PCI_DEVICE_ID_CMEDIA_CM8738:
^1da177e4c3f41 Linus Torvalds 2005-04-16  3239          case 
PCI_DEVICE_ID_CMEDIA_CM8738B:
^1da177e4c3f41 Linus Torvalds 2005-04-16  3240                  
strcpy(card->driver, "CMI8738");
^1da177e4c3f41 Linus Torvalds 2005-04-16  3241                  break;
^1da177e4c3f41 Linus Torvalds 2005-04-16  3242          case 
PCI_DEVICE_ID_CMEDIA_CM8338A:
^1da177e4c3f41 Linus Torvalds 2005-04-16  3243          case 
PCI_DEVICE_ID_CMEDIA_CM8338B:
^1da177e4c3f41 Linus Torvalds 2005-04-16  3244                  
strcpy(card->driver, "CMI8338");
^1da177e4c3f41 Linus Torvalds 2005-04-16  3245                  break;
^1da177e4c3f41 Linus Torvalds 2005-04-16  3246          default:
^1da177e4c3f41 Linus Torvalds 2005-04-16  3247                  
strcpy(card->driver, "CMIPCI");
^1da177e4c3f41 Linus Torvalds 2005-04-16  3248                  break;
^1da177e4c3f41 Linus Torvalds 2005-04-16  3249          }
^1da177e4c3f41 Linus Torvalds 2005-04-16  3250  
87e082ad84a7e1 Takashi Iwai   2021-07-15  3251          err = 
snd_cmipci_create(card, pci, dev);
e17a85eccfa0b7 Markus Elfring 2017-08-22  3252          if (err < 0)
87e082ad84a7e1 Takashi Iwai   2021-07-15  3253                  return err;
^1da177e4c3f41 Linus Torvalds 2005-04-16  3254  
e17a85eccfa0b7 Markus Elfring 2017-08-22  3255          err = 
snd_card_register(card);
e17a85eccfa0b7 Markus Elfring 2017-08-22  3256          if (err < 0)
87e082ad84a7e1 Takashi Iwai   2021-07-15  3257                  return err;
e17a85eccfa0b7 Markus Elfring 2017-08-22  3258  
^1da177e4c3f41 Linus Torvalds 2005-04-16  3259          pci_set_drvdata(pci, 
card);
^1da177e4c3f41 Linus Torvalds 2005-04-16  3260          dev++;
^1da177e4c3f41 Linus Torvalds 2005-04-16  3261          return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16  3262  }
^1da177e4c3f41 Linus Torvalds 2005-04-16  3263  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to