CC: [email protected]
TO: Li Wei <[email protected]>
CC: "Pan, Kris" <[email protected]>
CC: Chen Meng J <[email protected]>
CC: Meng Wei <[email protected]>

tree:   https://github.com/intel/linux-intel-lts.git 5.10/yocto
head:   224118987c7ad04fa24dffa2cd2719a9fdd6867d
commit: 91c71f14b406b0fe0f72f7e75e6a85e344b1927a [10626/14637] media: v4l2-mc: 
fix entity use_count issue for dual sensors
:::::: branch date: 6 days ago
:::::: commit date: 4 weeks ago
config: x86_64-randconfig-c001-20210728 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 
c49df15c278857adecd12db6bb1cdc96885f7079)
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 x86_64 cross compiling tool for clang build
        # apt-get install binutils-x86-64-linux-gnu
        # 
https://github.com/intel/linux-intel-lts/commit/91c71f14b406b0fe0f72f7e75e6a85e344b1927a
        git remote add intel-linux-intel-lts 
https://github.com/intel/linux-intel-lts.git
        git fetch --no-tags intel-linux-intel-lts 5.10/yocto
        git checkout 91c71f14b406b0fe0f72f7e75e6a85e344b1927a
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 
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/hid.h:998:28: note: Assuming 'bmap' is null
           if (unlikely(c > limit || !bmap)) {
                                     ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   include/linux/hid.h:998:28: note: Assuming pointer value is null
           if (unlikely(c > limit || !bmap)) {
                                     ^
   include/linux/compiler.h:78:42: note: expanded from macro 'unlikely'
   # define unlikely(x)    __builtin_expect(!!(x), 0)
                                               ^
   include/linux/hid.h:998:2: note: Taking true branch
           if (unlikely(c > limit || !bmap)) {
           ^
   include/linux/hid.h:999:3: note: Assuming the condition is true
                   pr_warn_ratelimited("%s: Invalid code %d type %d\n",
                   ^
   include/linux/printk.h:528:2: note: expanded from macro 'pr_warn_ratelimited'
           printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/printk.h:511:6: note: expanded from macro 'printk_ratelimited'
           if (__ratelimit(&_rs))                                          \
               ^~~~~~~~~~~~~~~~~
   include/linux/ratelimit_types.h:41:28: note: expanded from macro 
'__ratelimit'
   #define __ratelimit(state) ___ratelimit(state, __func__)
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/hid.h:999:3: note: Taking true branch
                   pr_warn_ratelimited("%s: Invalid code %d type %d\n",
                   ^
   include/linux/printk.h:528:2: note: expanded from macro 'pr_warn_ratelimited'
           printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
           ^
   include/linux/printk.h:511:2: note: expanded from macro 'printk_ratelimited'
           if (__ratelimit(&_rs))                                          \
           ^
   include/linux/hid.h:1000:9: note: Access to field 'name' results in a 
dereference of a null pointer (loaded from variable 'input')
                                       input->name, c, type);
                                       ^
   include/linux/printk.h:528:49: note: expanded from macro 
'pr_warn_ratelimited'
           printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
                                                          ^~~~~~~~~~~
   include/linux/printk.h:512:17: note: expanded from macro 'printk_ratelimited'
                   printk(fmt, ##__VA_ARGS__);                             \
                                 ^~~~~~~~~~~
   Suppressed 5 warnings (5 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   9 warnings generated.
   drivers/usb/storage/freecom.c:450:2: warning: Value stored to 'result' is 
never read [clang-analyzer-deadcode.DeadStores]
           result = usb_stor_control_msg(us, us->recv_ctrl_pipe,
           ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/storage/freecom.c:450:2: note: Value stored to 'result' is never 
read
           result = usb_stor_control_msg(us, us->recv_ctrl_pipe,
           ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/storage/freecom.c:463:2: warning: Value stored to 'result' is 
never read [clang-analyzer-deadcode.DeadStores]
           result = usb_stor_control_msg(us, us->send_ctrl_pipe,
           ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/storage/freecom.c:463:2: note: Value stored to 'result' is never 
read
           result = usb_stor_control_msg(us, us->send_ctrl_pipe,
           ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/storage/freecom.c:471:2: warning: Value stored to 'result' is 
never read [clang-analyzer-deadcode.DeadStores]
           result = usb_stor_control_msg(us, us->send_ctrl_pipe,
           ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/usb/storage/freecom.c:471:2: note: Value stored to 'result' is never 
read
           result = usb_stor_control_msg(us, us->send_ctrl_pipe,
           ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   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.
   5 warnings generated.
   Suppressed 5 warnings (5 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.
   Suppressed 5 warnings (5 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.
   Suppressed 5 warnings (5 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.
   sound/firewire/fireface/ff-hwdep.c:183: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(hwdep->name, ff->card->driver);
           ^~~~~~
   sound/firewire/fireface/ff-hwdep.c:183: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(hwdep->name, ff->card->driver);
           ^~~~~~
   Suppressed 5 warnings (5 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.
   Suppressed 5 warnings (5 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.
   Suppressed 5 warnings (5 in non-user code).
   Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
   8 warnings generated.
   drivers/media/v4l2-core/v4l2-mc.c:176:4: warning: Value stored to 'if_aud' 
is never read [clang-analyzer-deadcode.DeadStores]
                           if_aud = tuner;
                           ^        ~~~~~
   drivers/media/v4l2-core/v4l2-mc.c:176:4: note: Value stored to 'if_aud' is 
never read
                           if_aud = tuner;
                           ^        ~~~~~
>> drivers/media/v4l2-core/v4l2-mc.c:437:23: warning: Value stored to 'entity' 
>> during its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct media_entity *entity = pad->entity;
                                ^~~~~~   ~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-mc.c:437:23: note: Value stored to 'entity' 
during its initialization is never read
           struct media_entity *entity = pad->entity;
                                ^~~~~~   ~~~~~~~~~~~
   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.
   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.
   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.
   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.
   4 warnings generated.
   Suppressed 4 warnings (4 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.
   4 warnings generated.
   Suppressed 4 warnings (4 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.
   5 warnings generated.
   Suppressed 5 warnings (5 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.
   Suppressed 5 warnings (5 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.
   Suppressed 5 warnings (5 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.
   drivers/iio/light/adux1020.c:384:9: warning: Assigned value is garbage or 
undefined [clang-analyzer-core.uninitialized.Assign]
                           *val = buf[0];
                                ^ ~~~~~~
   drivers/iio/light/adux1020.c:372:2: note: Control jumps to 'case 
IIO_CHAN_INFO_RAW:'  at line 373
           switch (mask) {
           ^
   drivers/iio/light/adux1020.c:374:3: note: Control jumps to 'case 
IIO_PROXIMITY:'  at line 375
                   switch (chan->type) {
                   ^
   drivers/iio/light/adux1020.c:377:8: note: 'ret' is >= 0
                           if (ret < 0)
                               ^~~
   drivers/iio/light/adux1020.c:377:4: note: Taking false branch
                           if (ret < 0)
                           ^
   drivers/iio/light/adux1020.c:380:10: note: Calling 'adux1020_measure'
                           ret = adux1020_measure(data, ADUX1020_MODE_PROX_I, 
buf);
                                 
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/light/adux1020.c:320:6: note: Assuming 'ret' is >= 0
           if (ret < 0)
               ^~~~~~~
   drivers/iio/light/adux1020.c:320:2: note: Taking false branch
           if (ret < 0)
           ^
   drivers/iio/light/adux1020.c:327:6: note: Assuming 'ret' is >= 0
           if (ret < 0)
               ^~~~~~~
   drivers/iio/light/adux1020.c:327:2: note: Taking false branch
           if (ret < 0)
           ^
   drivers/iio/light/adux1020.c:330:2: note: Loop condition is true.  Entering 
loop body
           while (tries--) {
           ^
   drivers/iio/light/adux1020.c:333:7: note: Assuming 'ret' is >= 0
                   if (ret < 0)
                       ^~~~~~~
   drivers/iio/light/adux1020.c:333:3: note: Taking false branch
                   if (ret < 0)
                   ^
   drivers/iio/light/adux1020.c:337:7: note: Assuming 'status' is >= field 
'bytes'
                   if (status >= adux1020_modes[mode].bytes)
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/light/adux1020.c:337:3: note: Taking true branch
                   if (status >= adux1020_modes[mode].bytes)
                   ^
   drivers/iio/light/adux1020.c:338:4: note:  Execution continues on line 342
                           break;
                           ^
   drivers/iio/light/adux1020.c:342:6: note: 'tries' is >= 0
           if (tries < 0)
               ^~~~~
   drivers/iio/light/adux1020.c:342:2: note: Taking false branch
           if (tries < 0)
           ^
   drivers/iio/light/adux1020.c:345:8: note: Calling 'adux1020_read_fifo'
           ret = adux1020_read_fifo(data, val, adux1020_modes[mode].buf_len);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/iio/light/adux1020.c:260:6: note: Assuming 'ret' is >= 0
           if (ret < 0)
               ^~~~~~~
   drivers/iio/light/adux1020.c:260:2: note: Taking false branch
           if (ret < 0)
           ^
   drivers/iio/light/adux1020.c:263:14: note: Assuming 'i' is >= 'buf_len'
           for (i = 0; i < buf_len; i++) {

vim +/entity +437 drivers/media/v4l2-core/v4l2-mc.c

0d3c81e82da90f Steve Longerbeam 2020-05-01  406  
76413791a03f8f Sakari Ailus     2016-02-21  407  /* 
-----------------------------------------------------------------------------
76413791a03f8f Sakari Ailus     2016-02-21  408   * Pipeline power management
76413791a03f8f Sakari Ailus     2016-02-21  409   *
76413791a03f8f Sakari Ailus     2016-02-21  410   * Entities must be powered up 
when part of a pipeline that contains at least
76413791a03f8f Sakari Ailus     2016-02-21  411   * one open video device node.
76413791a03f8f Sakari Ailus     2016-02-21  412   *
76413791a03f8f Sakari Ailus     2016-02-21  413   * To achieve this use the 
entity use_count field to track the number of users.
76413791a03f8f Sakari Ailus     2016-02-21  414   * For entities corresponding 
to video device nodes the use_count field stores
76413791a03f8f Sakari Ailus     2016-02-21  415   * the users count of the 
node. For entities corresponding to subdevs the
76413791a03f8f Sakari Ailus     2016-02-21  416   * use_count field stores the 
total number of users of all video device nodes
76413791a03f8f Sakari Ailus     2016-02-21  417   * in the pipeline.
76413791a03f8f Sakari Ailus     2016-02-21  418   *
8fd390b89cc8ca Ezequiel Garcia  2020-01-24  419   * The v4l2_pipeline_pm_{get, 
put}() functions must be called in the open() and
76413791a03f8f Sakari Ailus     2016-02-21  420   * close() handlers of video 
device nodes. It increments or decrements the use
76413791a03f8f Sakari Ailus     2016-02-21  421   * count of all subdev 
entities in the pipeline.
76413791a03f8f Sakari Ailus     2016-02-21  422   *
76413791a03f8f Sakari Ailus     2016-02-21  423   * To react to link management 
on powered pipelines, the link setup notification
76413791a03f8f Sakari Ailus     2016-02-21  424   * callback updates the use 
count of all entities in the source and sink sides
76413791a03f8f Sakari Ailus     2016-02-21  425   * of the link.
76413791a03f8f Sakari Ailus     2016-02-21  426   */
76413791a03f8f Sakari Ailus     2016-02-21  427  
76413791a03f8f Sakari Ailus     2016-02-21  428  /*
76413791a03f8f Sakari Ailus     2016-02-21  429   * pipeline_pm_use_count - 
Count the number of users of a pipeline
76413791a03f8f Sakari Ailus     2016-02-21  430   * @entity: The entity
76413791a03f8f Sakari Ailus     2016-02-21  431   *
76413791a03f8f Sakari Ailus     2016-02-21  432   * Return the total number of 
users of all video device nodes in the pipeline.
76413791a03f8f Sakari Ailus     2016-02-21  433   */
91c71f14b406b0 Li Wei           2018-01-17  434  static int 
pipeline_pm_use_count(struct media_pad *pad,
20b852273642f4 Sakari Ailus     2016-11-21  435         struct media_graph 
*graph)
76413791a03f8f Sakari Ailus     2016-02-21  436  {
91c71f14b406b0 Li Wei           2018-01-17 @437         struct media_entity 
*entity = pad->entity;
76413791a03f8f Sakari Ailus     2016-02-21  438         int use = 0;
76413791a03f8f Sakari Ailus     2016-02-21  439  
91c71f14b406b0 Li Wei           2018-01-17  440         
media_graph_walk_start(graph, pad);
76413791a03f8f Sakari Ailus     2016-02-21  441  
20b852273642f4 Sakari Ailus     2016-11-21  442         while ((entity = 
media_graph_walk_next(graph))) {
45b46879a78567 Laurent Pinchart 2016-02-29  443                 if 
(is_media_entity_v4l2_video_device(entity))
76413791a03f8f Sakari Ailus     2016-02-21  444                         use += 
entity->use_count;
76413791a03f8f Sakari Ailus     2016-02-21  445         }
76413791a03f8f Sakari Ailus     2016-02-21  446  
76413791a03f8f Sakari Ailus     2016-02-21  447         return use;
76413791a03f8f Sakari Ailus     2016-02-21  448  }
76413791a03f8f Sakari Ailus     2016-02-21  449  

---
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