:::::: 
:::::: Manual check reason: "low confidence static check warning: 
drivers/usb/host/xhci-plat.c:196:25: warning: Value stored to 'priv' during its 
initialization is never read [clang-analyzer-deadcode.DeadStores]"
:::::: 

CC: [email protected]
CC: [email protected]
BCC: [email protected]
In-Reply-To: 
<fdd35b176f74e80fd75e4f75731e0f26c0808c89.1654310542.git.thinh.ngu...@synopsys.com>
References: 
<fdd35b176f74e80fd75e4f75731e0f26c0808c89.1654310542.git.thinh.ngu...@synopsys.com>
TO: Thinh Nguyen <[email protected]>

Hi Thinh,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on 97fa5887cf283bb75ffff5f6b2c0e71794c02400]

url:    
https://github.com/intel-lab-lkp/linux/commits/Thinh-Nguyen/usb-xhci-Introduce-xhci-snps/20220606-004743
base:   97fa5887cf283bb75ffff5f6b2c0e71794c02400
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: arm-randconfig-c002-20220605 
(https://download.01.org/0day-ci/archive/20220607/[email protected]/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 
b92436efcb7813fc481b30f2593a4907568d917a)
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://github.com/intel-lab-lkp/linux/commit/f2403a44ab42c6e321dbd2b12c754321a30c09f6
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review 
Thinh-Nguyen/usb-xhci-Introduce-xhci-snps/20220606-004743
        git checkout f2403a44ab42c6e321dbd2b12c754321a30c09f6
        # save the config file
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm 
clang-analyzer 

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


clang-analyzer warnings: (new ones prefixed by >>)
           if (buscfg->interface == ISP_INTERFACE_CCP2B_PHY1
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/platform/ti/omap3isp/ispcsiphy.c:172:6: note: Left side of 
'||' is false
   drivers/media/platform/ti/omap3isp/ispcsiphy.c:173:9: note: Assuming field 
'interface' is not equal to ISP_INTERFACE_CCP2B_PHY2
               || buscfg->interface == ISP_INTERFACE_CCP2B_PHY2) {
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/platform/ti/omap3isp/ispcsiphy.c:172:2: note: Taking false 
branch
           if (buscfg->interface == ISP_INTERFACE_CCP2B_PHY1
           ^
   drivers/media/platform/ti/omap3isp/ispcsiphy.c:181:6: note: Assuming 
'num_data_lanes' is <= field 'num_data_lanes'
           if (num_data_lanes > phy->num_data_lanes)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/platform/ti/omap3isp/ispcsiphy.c:181:2: note: Taking false 
branch
           if (num_data_lanes > phy->num_data_lanes)
           ^
   drivers/media/platform/ti/omap3isp/ispcsiphy.c:185:14: note: Assuming 'i' is 
>= 'num_data_lanes'
           for (i = 0; i < num_data_lanes; i++) {
                       ^~~~~~~~~~~~~~~~~~
   drivers/media/platform/ti/omap3isp/ispcsiphy.c:185:2: note: Loop condition 
is false. Execution continues on line 195
           for (i = 0; i < num_data_lanes; i++) {
           ^
   drivers/media/platform/ti/omap3isp/ispcsiphy.c:195:6: note: Assuming field 
'pol' is <= 1
           if (lanes->clk.pol > 1 || lanes->clk.pos > 3)
               ^~~~~~~~~~~~~~~~~~
   drivers/media/platform/ti/omap3isp/ispcsiphy.c:195:6: note: Left side of 
'||' is false
   drivers/media/platform/ti/omap3isp/ispcsiphy.c:195:28: note: Assuming field 
'pos' is <= 3
           if (lanes->clk.pol > 1 || lanes->clk.pos > 3)
                                     ^~~~~~~~~~~~~~~~~~
   drivers/media/platform/ti/omap3isp/ispcsiphy.c:195:2: note: Taking false 
branch
           if (lanes->clk.pol > 1 || lanes->clk.pos > 3)
           ^
   drivers/media/platform/ti/omap3isp/ispcsiphy.c:198:6: note: Assuming field 
'pos' is not equal to 0
           if (lanes->clk.pos == 0 || used_lanes & (1 << lanes->clk.pos))
               ^~~~~~~~~~~~~~~~~~~
   drivers/media/platform/ti/omap3isp/ispcsiphy.c:198:6: note: Left side of 
'||' is false
   drivers/media/platform/ti/omap3isp/ispcsiphy.c:198:2: note: Taking false 
branch
           if (lanes->clk.pos == 0 || used_lanes & (1 << lanes->clk.pos))
           ^
   drivers/media/platform/ti/omap3isp/ispcsiphy.c:206:2: note: Calling 
'csiphy_routing_cfg'
           csiphy_routing_cfg(phy, buscfg->interface, true,
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/platform/ti/omap3isp/ispcsiphy.c:105:6: note: Assuming field 
'phy_type' is equal to ISP_PHY_TYPE_3630
           if (phy->isp->phy_type == ISP_PHY_TYPE_3630 && on)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/platform/ti/omap3isp/ispcsiphy.c:105:6: note: Left side of 
'&&' is true
   drivers/media/platform/ti/omap3isp/ispcsiphy.c:105:49: note: 'on' is true
           if (phy->isp->phy_type == ISP_PHY_TYPE_3630 && on)
                                                          ^~
   drivers/media/platform/ti/omap3isp/ispcsiphy.c:105:2: note: Taking true 
branch
           if (phy->isp->phy_type == ISP_PHY_TYPE_3630 && on)
           ^
   drivers/media/platform/ti/omap3isp/ispcsiphy.c:106:10: note: Calling 
'csiphy_routing_cfg_3630'
                   return csiphy_routing_cfg_3630(phy, iface, ccp2_strobe);
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/platform/ti/omap3isp/ispcsiphy.c:28:13: note: 'mode' declared 
without an initial value
           u32 shift, mode;
                      ^~~~
   drivers/media/platform/ti/omap3isp/ispcsiphy.c:32:2: note: Control jumps to 
the 'default' case at line 33
           switch (iface) {
           ^
   drivers/media/platform/ti/omap3isp/ispcsiphy.c:38:3: note:  Execution 
continues on line 54
                   break;
                   ^
   drivers/media/platform/ti/omap3isp/ispcsiphy.c:54:6: note: 'iface' is not 
equal to ISP_INTERFACE_CCP2B_PHY1
           if (iface == ISP_INTERFACE_CCP2B_PHY1 ||
               ^~~~~
   drivers/media/platform/ti/omap3isp/ispcsiphy.c:54:6: note: Left side of '||' 
is false
   drivers/media/platform/ti/omap3isp/ispcsiphy.c:55:6: note: 'iface' is not 
equal to ISP_INTERFACE_CCP2B_PHY2
               iface == ISP_INTERFACE_CCP2B_PHY2) {
               ^~~~~
   drivers/media/platform/ti/omap3isp/ispcsiphy.c:54:2: note: Taking false 
branch
           if (iface == ISP_INTERFACE_CCP2B_PHY1 ||
           ^
   drivers/media/platform/ti/omap3isp/ispcsiphy.c:63:14: note: The left operand 
of '<<' is a garbage value
           reg |= mode << shift;
                  ~~~~ ^
   Suppressed 46 warnings (45 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.
   31 warnings generated.
   drivers/of/base.c:1296:2: warning: Call to function 'memset' is insecure as 
it does not provide security checks introduced in the C11 standard. Replace 
with analogous functions that support length arguments or provides boundary 
checks such as 'memset_s' in case of C11 
[clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           memset(it, 0, sizeof(*it));
           ^~~~~~
   drivers/of/base.c:1296:2: note: Call to function 'memset' is insecure as it 
does not provide security checks introduced in the C11 standard. Replace with 
analogous functions that support length arguments or provides boundary checks 
such as 'memset_s' in case of C11
           memset(it, 0, sizeof(*it));
           ^~~~~~
   drivers/of/base.c:1886:2: warning: Call to function 'strncpy' is insecure as 
it does not provide security checks introduced in the C11 standard. Replace 
with analogous functions that support length arguments or provides boundary 
checks such as 'strncpy_s' in case of C11 
[clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           strncpy(ap->stem, stem, stem_len);
           ^~~~~~~
   drivers/of/base.c:1886:2: note: Call to function 'strncpy' is insecure as it 
does not provide security checks introduced in the C11 standard. Replace with 
analogous functions that support length arguments or provides boundary checks 
such as 'strncpy_s' in case of C11
           strncpy(ap->stem, stem, stem_len);
           ^~~~~~~
   drivers/of/base.c:1957:3: warning: Call to function 'memset' is insecure as 
it does not provide security checks introduced in the C11 standard. Replace 
with analogous functions that support length arguments or provides boundary 
checks such as 'memset_s' in case of C11 
[clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
                   memset(ap, 0, sizeof(*ap) + len + 1);
                   ^~~~~~
   drivers/of/base.c:1957:3: note: Call to function 'memset' is insecure as it 
does not provide security checks introduced in the C11 standard. Replace with 
analogous functions that support length arguments or provides boundary checks 
such as 'memset_s' in case of C11
                   memset(ap, 0, sizeof(*ap) + len + 1);
                   ^~~~~~
   Suppressed 28 warnings (28 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.
   113 warnings generated.
>> drivers/usb/host/xhci-plat.c:196:25: warning: Value stored to 'priv' during 
>> its initialization is never read [clang-analyzer-deadcode.DeadStores]
           struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
                                  ^~~~
   drivers/usb/host/xhci-plat.c:196:25: note: Value stored to 'priv' during its 
initialization is never read
           struct xhci_plat_priv *priv = hcd_to_xhci_priv(hcd);
                                  ^~~~
   drivers/usb/host/xhci-plat.c:255:15: warning: Access to field 'dma_mask' 
results in a dereference of a null pointer (loaded from variable 'sysdev') 
[clang-analyzer-core.NullDereference]
           if (WARN_ON(!sysdev->dma_mask))
                        ^
   include/asm-generic/bug.h:167:25: note: expanded from macro 'WARN_ON'
           int __ret_warn_on = !!(condition);                              \
                                  ^~~~~~~~~
   drivers/usb/host/xhci-plat.c:226:6: note: Assuming the condition is false
           if (usb_disabled())
               ^~~~~~~~~~~~~~
   drivers/usb/host/xhci-plat.c:226:2: note: Taking false branch
           if (usb_disabled())
           ^
   drivers/usb/host/xhci-plat.c:232:6: note: Assuming 'irq' is >= 0
           if (irq < 0)
               ^~~~~~~
   drivers/usb/host/xhci-plat.c:232:2: note: Taking false branch
           if (irq < 0)
           ^
   drivers/usb/host/xhci-plat.c:242:28: note: Assuming pointer value is null
           for (sysdev = &pdev->dev; sysdev; sysdev = sysdev->parent) {
                                     ^~~~~~
   drivers/usb/host/xhci-plat.c:242:2: note: Loop condition is false. Execution 
continues on line 252
           for (sysdev = &pdev->dev; sysdev; sysdev = sysdev->parent) {
           ^
   drivers/usb/host/xhci-plat.c:252:7: note: 'sysdev' is null
           if (!sysdev)
                ^~~~~~
   drivers/usb/host/xhci-plat.c:252:2: note: Taking true branch
           if (!sysdev)
           ^
   drivers/usb/host/xhci-plat.c:253:3: note: Null pointer value stored to 
'sysdev'
                   sysdev = &pdev->dev;
                   ^~~~~~~~~~~~~~~~~~~
   drivers/usb/host/xhci-plat.c:255:15: note: Access to field 'dma_mask' 
results in a dereference of a null pointer (loaded from variable 'sysdev')
           if (WARN_ON(!sysdev->dma_mask))
                        ^
   include/asm-generic/bug.h:167:25: note: expanded from macro 'WARN_ON'
           int __ret_warn_on = !!(condition);                              \
                                  ^~~~~~~~~
   Suppressed 111 warnings (111 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.
   98 warnings generated.
   Suppressed 98 warnings (98 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.
   99 warnings generated.
   Suppressed 99 warnings (99 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.
   111 warnings generated.
   Suppressed 111 warnings (111 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.
   30 warnings generated.
   sound/core/seq/seq_timer.c:270:2: warning: Call to function 'sprintf' is 
insecure as it does not provide security checks introduced in the C11 standard. 
Replace with analogous functions that support length arguments or provides 
boundary checks such as 'sprintf_s' in case of C11 
[clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           sprintf(str, "sequencer queue %i", q->queue);
           ^~~~~~~
   sound/core/seq/seq_timer.c:270:2: note: Call to function 'sprintf' is 
insecure as it does not provide security checks introduced in the C11 standard. 
Replace with analogous functions that support length arguments or provides 
boundary checks such as 'sprintf_s' in case of C11
           sprintf(str, "sequencer queue %i", q->queue);
           ^~~~~~~
   sound/core/seq/seq_timer.c:286:4: warning: Call to function 'memset' is 
insecure as it does not provide security checks introduced in the C11 standard. 
Replace with analogous functions that support length arguments or provides 
boundary checks such as 'memset_s' in case of C11 
[clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
                           memset(&tid, 0, sizeof(tid));
                           ^~~~~~
   sound/core/seq/seq_timer.c:286:4: note: Call to function 'memset' is 
insecure as it does not provide security checks introduced in the C11 standard. 
Replace with analogous functions that support length arguments or provides 
boundary checks such as 'memset_s' in case of C11
                           memset(&tid, 0, sizeof(tid));
                           ^~~~~~
   Suppressed 28 warnings (28 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.
   30 warnings generated.
   sound/core/seq/seq_system.c:60:2: warning: Call to function 'memset' is 
insecure as it does not provide security checks introduced in the C11 standard. 
Replace with analogous functions that support length arguments or provides 
boundary checks such as 'memset_s' in case of C11 
[clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           memset(ev, 0, sizeof(struct snd_seq_event));
           ^~~~~~
   sound/core/seq/seq_system.c:60:2: note: Call to function 'memset' is 
insecure as it does not provide security checks introduced in the C11 standard. 
Replace with analogous functions that support length arguments or provides 
boundary checks such as 'memset_s' in case of C11
           memset(ev, 0, sizeof(struct snd_seq_event));
           ^~~~~~
   sound/core/seq/seq_system.c:117:2: warning: Call to function 'memset' is 
insecure as it does not provide security checks introduced in the C11 standard. 
Replace with analogous functions that support length arguments or provides 
boundary checks such as 'memset_s' in case of C11 
[clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           memset(&pcallbacks, 0, sizeof(pcallbacks));
           ^~~~~~
   sound/core/seq/seq_system.c:117:2: note: Call to function 'memset' is 
insecure as it does not provide security checks introduced in the C11 standard. 
Replace with analogous functions that support length arguments or provides 
boundary checks such as 'memset_s' in case of C11
           memset(&pcallbacks, 0, sizeof(pcallbacks));
           ^~~~~~
   Suppressed 28 warnings (28 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.
   32 warnings generated.
   drivers/hwtracing/intel_th/gth.c:157:11: warning: Call to function 
'snprintf' is insecure as it does not provide security checks introduced in the 
C11 standard. Replace with analogous functions that support length arguments or 
provides boundary checks such as 'snprintf_s' in case of C11 
[clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
                   count = snprintf(buf, PAGE_SIZE, "%x\n", port);
                           ^~~~~~~~
   drivers/hwtracing/intel_th/gth.c:157:11: note: Call to function 'snprintf' 
is insecure as it does not provide security checks introduced in the C11 
standard. Replace with analogous functions that support length arguments or 
provides boundary checks such as 'snprintf_s' in case of C11
                   count = snprintf(buf, PAGE_SIZE, "%x\n", port);
                           ^~~~~~~~
   drivers/hwtracing/intel_th/gth.c:159:11: warning: Call to function 
'snprintf' is insecure as it does not provide security checks introduced in the 
C11 standard. Replace with analogous functions that support length arguments or 
provides boundary checks such as 'snprintf_s' in case of C11 
[clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
                   count = snprintf(buf, PAGE_SIZE, "disabled\n");
                           ^~~~~~~~
   drivers/hwtracing/intel_th/gth.c:159:11: note: Call to function 'snprintf' 
is insecure as it does not provide security checks introduced in the C11 
standard. Replace with analogous functions that support length arguments or 
provides boundary checks such as 'snprintf_s' in case of C11
                   count = snprintf(buf, PAGE_SIZE, "disabled\n");
                           ^~~~~~~~
   drivers/hwtracing/intel_th/gth.c:335:10: warning: Call to function 
'snprintf' is insecure as it does not provide security checks introduced in the 
C11 standard. Replace with analogous functions that support length arguments or 
provides boundary checks such as 'snprintf_s' in case of C11 
[clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           count = snprintf(buf, PAGE_SIZE, "%x\n",

vim +/priv +196 drivers/usb/host/xhci-plat.c

4efb2f69411456d Yoshihiro Shimoda 2015-11-24  193  
f2403a44ab42c6e Thinh Nguyen      2022-06-03  194  static int 
xhci_plat_setup_snps_quirks(struct usb_hcd *hcd)
f2403a44ab42c6e Thinh Nguyen      2022-06-03  195  {
f2403a44ab42c6e Thinh Nguyen      2022-06-03 @196       struct xhci_plat_priv 
*priv = hcd_to_xhci_priv(hcd);
f2403a44ab42c6e Thinh Nguyen      2022-06-03  197       int ret;
f2403a44ab42c6e Thinh Nguyen      2022-06-03  198  
f2403a44ab42c6e Thinh Nguyen      2022-06-03  199       if 
(!IS_ENABLED(CONFIG_USB_XHCI_SNPS))
f2403a44ab42c6e Thinh Nguyen      2022-06-03  200               return 0;
f2403a44ab42c6e Thinh Nguyen      2022-06-03  201  
f2403a44ab42c6e Thinh Nguyen      2022-06-03  202       ret = 
xhci_snps_init(hcd);
f2403a44ab42c6e Thinh Nguyen      2022-06-03  203       if (ret) {
f2403a44ab42c6e Thinh Nguyen      2022-06-03  204               
dev_err(hcd->self.controller, "SNPS extension setup fails\n");
f2403a44ab42c6e Thinh Nguyen      2022-06-03  205               return ret;
f2403a44ab42c6e Thinh Nguyen      2022-06-03  206       }
f2403a44ab42c6e Thinh Nguyen      2022-06-03  207  
f2403a44ab42c6e Thinh Nguyen      2022-06-03  208       priv->init_quirk = 
&xhci_snps_setup;
f2403a44ab42c6e Thinh Nguyen      2022-06-03  209       
priv->add_endpoint_quirk = &xhci_snps_add_endpoint;
f2403a44ab42c6e Thinh Nguyen      2022-06-03  210       return 0;
f2403a44ab42c6e Thinh Nguyen      2022-06-03  211  }
f2403a44ab42c6e Thinh Nguyen      2022-06-03  212  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to