CC: [email protected]
CC: [email protected]
BCC: [email protected]
CC: [email protected]
CC: [email protected]
TO: Stephane Eranian <[email protected]>
CC: Peter Zijlstra <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core
head:   7bebfe9dd802b80abff5a43e00ab68d98893a22c
commit: ada543459cab7f653dcacdaba4011a8bb19c627c [3/10] perf/x86/amd: Add AMD 
Fam19h Branch Sampling support
:::::: branch date: 6 days ago
:::::: commit date: 6 days ago
config: x86_64-randconfig-c007 
(https://download.01.org/0day-ci/archive/20220411/[email protected]/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 
c29a51b3a257908aebc01cd7c4655665db317d66)
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/tip/tip.git/commit/?id=ada543459cab7f653dcacdaba4011a8bb19c627c
        git remote add tip 
https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
        git fetch --no-tags tip perf/core
        git checkout ada543459cab7f653dcacdaba4011a8bb19c627c
        # save the config file 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 >>)
   crypto/asymmetric_keys/asymmetric_type.c:64:2: note: Loop condition is 
false.  Exiting loop
           WARN_ON(!id_0 && !id_1 && !id_2);
           ^
   include/asm-generic/bug.h:123:3: note: expanded from macro 'WARN_ON'
                   __WARN();                                               \
                   ^
   include/asm-generic/bug.h:96:19: note: expanded from macro '__WARN'
   #define __WARN()                __WARN_FLAGS(BUGFLAG_TAINT(TAINT_WARN))
                                   ^
   arch/x86/include/asm/bug.h:79:33: note: expanded from macro '__WARN_FLAGS'
   #define __WARN_FLAGS(flags)                                     \
                                                                   ^
   crypto/asymmetric_keys/asymmetric_type.c:66:6: note: 'id_0' is null
           if (id_0) {
               ^~~~
   crypto/asymmetric_keys/asymmetric_type.c:66:2: note: Taking false branch
           if (id_0) {
           ^
   crypto/asymmetric_keys/asymmetric_type.c:69:13: note: 'id_1' is null
           } else if (id_1) {
                      ^~~~
   crypto/asymmetric_keys/asymmetric_type.c:69:9: note: Taking false branch
           } else if (id_1) {
                  ^
   crypto/asymmetric_keys/asymmetric_type.c:74:9: note: Access to field 'len' 
results in a dereference of a null pointer (loaded from variable 'id_2')
                   len = id_2->len;
                         ^~~~
   crypto/asymmetric_keys/asymmetric_type.c:160:2: warning: Call to function 
'memcpy' 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 'memcpy_s' in case of C11 
[clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           memcpy(kid->data, val_1, len_1);
           ^
   include/linux/fortify-string.h:369:26: note: expanded from macro 'memcpy'
   #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s,                  \
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:362:2: note: expanded from macro 
'__fortify_memcpy_chk'
           __underlying_##op(p, q, __fortify_size);                        \
           ^~~~~~~~~~~~~~~~~
   note: expanded from here
   include/linux/fortify-string.h:45:29: note: expanded from macro 
'__underlying_memcpy'
   #define __underlying_memcpy     __builtin_memcpy
                                   ^~~~~~~~~~~~~~~~
   crypto/asymmetric_keys/asymmetric_type.c:160:2: note: Call to function 
'memcpy' 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 'memcpy_s' in case of C11
           memcpy(kid->data, val_1, len_1);
           ^
   include/linux/fortify-string.h:369:26: note: expanded from macro 'memcpy'
   #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s,                  \
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:362:2: note: expanded from macro 
'__fortify_memcpy_chk'
           __underlying_##op(p, q, __fortify_size);                        \
           ^~~~~~~~~~~~~~~~~
   note: expanded from here
   include/linux/fortify-string.h:45:29: note: expanded from macro 
'__underlying_memcpy'
   #define __underlying_memcpy     __builtin_memcpy
                                   ^~~~~~~~~~~~~~~~
   crypto/asymmetric_keys/asymmetric_type.c:161:2: warning: Call to function 
'memcpy' 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 'memcpy_s' in case of C11 
[clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
           memcpy(kid->data + len_1, val_2, len_2);
           ^
   include/linux/fortify-string.h:369:26: note: expanded from macro 'memcpy'
   #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s,                  \
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:362:2: note: expanded from macro 
'__fortify_memcpy_chk'
           __underlying_##op(p, q, __fortify_size);                        \
           ^~~~~~~~~~~~~~~~~
   note: expanded from here
   include/linux/fortify-string.h:45:29: note: expanded from macro 
'__underlying_memcpy'
   #define __underlying_memcpy     __builtin_memcpy
                                   ^~~~~~~~~~~~~~~~
   crypto/asymmetric_keys/asymmetric_type.c:161:2: note: Call to function 
'memcpy' 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 'memcpy_s' in case of C11
           memcpy(kid->data + len_1, val_2, len_2);
           ^
   include/linux/fortify-string.h:369:26: note: expanded from macro 'memcpy'
   #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s,                  \
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:362:2: note: expanded from macro 
'__fortify_memcpy_chk'
           __underlying_##op(p, q, __fortify_size);                        \
           ^~~~~~~~~~~~~~~~~
   note: expanded from here
   include/linux/fortify-string.h:45:29: note: expanded from macro 
'__underlying_memcpy'
   #define __underlying_memcpy     __builtin_memcpy
                                   ^~~~~~~~~~~~~~~~
   Suppressed 33 warnings (33 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.
   16 warnings generated.
   Suppressed 16 warnings (16 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.
   37 warnings generated.
   arch/x86/events/rapl.c:432:1: 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]
   PMU_FORMAT_ATTR(event, "config:0-7");
   ^
   include/linux/perf_event.h:1635:9: note: expanded from macro 
'PMU_FORMAT_ATTR'
           return sprintf(page, _format "\n");                             \
                  ^~~~~~~
   arch/x86/events/rapl.c:432:1: 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
   PMU_FORMAT_ATTR(event, "config:0-7");
   ^
   include/linux/perf_event.h:1635:9: note: expanded from macro 
'PMU_FORMAT_ATTR'
           return sprintf(page, _format "\n");                             \
                  ^~~~~~~
   Suppressed 36 warnings (36 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.
   46 warnings generated.
>> arch/x86/events/amd/core.c:722:3: warning: Value stored to 'hwc' is never 
>> read [clang-analyzer-deadcode.DeadStores]
                   hwc = &cpuc->events[idx]->hw;
                   ^     ~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/events/amd/core.c:722:3: note: Value stored to 'hwc' is never read
                   hwc = &cpuc->events[idx]->hw;
                   ^     ~~~~~~~~~~~~~~~~~~~~~~
   arch/x86/events/amd/core.c:842:1: 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]
   PMU_FORMAT_ATTR(event,  "config:0-7,32-35");
   ^
   include/linux/perf_event.h:1635:9: note: expanded from macro 
'PMU_FORMAT_ATTR'
           return sprintf(page, _format "\n");                             \
                  ^~~~~~~
   arch/x86/events/amd/core.c:842:1: 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
   PMU_FORMAT_ATTR(event,  "config:0-7,32-35");
   ^
   include/linux/perf_event.h:1635:9: note: expanded from macro 
'PMU_FORMAT_ATTR'
           return sprintf(page, _format "\n");                             \
                  ^~~~~~~
   arch/x86/events/amd/core.c:843:1: 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]
   PMU_FORMAT_ATTR(umask,  "config:8-15"   );
   ^
   include/linux/perf_event.h:1635:9: note: expanded from macro 
'PMU_FORMAT_ATTR'
           return sprintf(page, _format "\n");                             \
                  ^~~~~~~
   arch/x86/events/amd/core.c:843:1: 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
   PMU_FORMAT_ATTR(umask,  "config:8-15"   );
   ^
   include/linux/perf_event.h:1635:9: note: expanded from macro 
'PMU_FORMAT_ATTR'
           return sprintf(page, _format "\n");                             \
                  ^~~~~~~
   arch/x86/events/amd/core.c:844:1: 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]
   PMU_FORMAT_ATTR(edge,   "config:18"     );
   ^
   include/linux/perf_event.h:1635:9: note: expanded from macro 
'PMU_FORMAT_ATTR'
           return sprintf(page, _format "\n");                             \
                  ^~~~~~~
   arch/x86/events/amd/core.c:844:1: 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
   PMU_FORMAT_ATTR(edge,   "config:18"     );
   ^
   include/linux/perf_event.h:1635:9: note: expanded from macro 
'PMU_FORMAT_ATTR'
           return sprintf(page, _format "\n");                             \
                  ^~~~~~~
   arch/x86/events/amd/core.c:845:1: 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]
   PMU_FORMAT_ATTR(inv,    "config:23"     );
   ^
   include/linux/perf_event.h:1635:9: note: expanded from macro 
'PMU_FORMAT_ATTR'
           return sprintf(page, _format "\n");                             \
                  ^~~~~~~
   arch/x86/events/amd/core.c:845:1: 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
   PMU_FORMAT_ATTR(inv,    "config:23"     );
   ^
   include/linux/perf_event.h:1635:9: note: expanded from macro 
'PMU_FORMAT_ATTR'
           return sprintf(page, _format "\n");                             \
                  ^~~~~~~
   arch/x86/events/amd/core.c:846:1: 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]
   PMU_FORMAT_ATTR(cmask,  "config:24-31"  );
   ^
   include/linux/perf_event.h:1635:9: note: expanded from macro 
'PMU_FORMAT_ATTR'
           return sprintf(page, _format "\n");                             \
                  ^~~~~~~
   arch/x86/events/amd/core.c:846:1: 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
   PMU_FORMAT_ATTR(cmask,  "config:24-31"  );
   ^
   include/linux/perf_event.h:1635:9: note: expanded from macro 
'PMU_FORMAT_ATTR'
           return sprintf(page, _format "\n");                             \
                  ^~~~~~~
   arch/x86/events/amd/core.c:1126:9: 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]
           return snprintf(buf, PAGE_SIZE, "%d\n", x86_pmu.lbr_nr);
                  ^~~~~~~~
   arch/x86/events/amd/core.c:1126:9: 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
           return snprintf(buf, PAGE_SIZE, "%d\n", x86_pmu.lbr_nr);
                  ^~~~~~~~
   arch/x86/events/amd/core.c:1244:3: warning: Call to function 'memcpy' 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 'memcpy_s' in case of C11 
[clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
                   memcpy(hw_cache_event_ids, amd_hw_cache_event_ids_f17h, 
sizeof(hw_cache_event_ids));
                   ^
   include/linux/fortify-string.h:369:26: note: expanded from macro 'memcpy'
   #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s,                  \
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:362:2: note: expanded from macro 
'__fortify_memcpy_chk'
           __underlying_##op(p, q, __fortify_size);                        \
           ^~~~~~~~~~~~~~~~~
   note: expanded from here
   include/linux/fortify-string.h:45:29: note: expanded from macro 
'__underlying_memcpy'
   #define __underlying_memcpy     __builtin_memcpy
                                   ^~~~~~~~~~~~~~~~
   arch/x86/events/amd/core.c:1244:3: note: Call to function 'memcpy' 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 'memcpy_s' in case of C11
                   memcpy(hw_cache_event_ids, amd_hw_cache_event_ids_f17h, 
sizeof(hw_cache_event_ids));
                   ^
   include/linux/fortify-string.h:369:26: note: expanded from macro 'memcpy'
   #define memcpy(p, q, s)  __fortify_memcpy_chk(p, q, s,                  \
                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/fortify-string.h:362:2: note: expanded from macro 
'__fortify_memcpy_chk'
           __underlying_##op(p, q, __fortify_size);                        \
           ^~~~~~~~~~~~~~~~~
   note: expanded from here
   include/linux/fortify-string.h:45:29: note: expanded from macro 
'__underlying_memcpy'
   #define __underlying_memcpy     __builtin_memcpy
                                   ^~~~~~~~~~~~~~~~
   arch/x86/events/amd/core.c:1246:3: warning: Call to function 'memcpy' 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 'memcpy_s' in case of C11 
[clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling]
                   memcpy(hw_cache_event_ids, amd_hw_cache_event_ids, 
sizeof(hw_cache_event_ids));
                   ^

vim +/hwc +722 arch/x86/events/amd/core.c

ada543459cab7f Stephane Eranian 2022-03-22  712  
ada543459cab7f Stephane Eranian 2022-03-22  713  static void 
amd_pmu_enable_all(int added)
ada543459cab7f Stephane Eranian 2022-03-22  714  {
ada543459cab7f Stephane Eranian 2022-03-22  715         struct cpu_hw_events 
*cpuc = this_cpu_ptr(&cpu_hw_events);
ada543459cab7f Stephane Eranian 2022-03-22  716         struct hw_perf_event 
*hwc;
ada543459cab7f Stephane Eranian 2022-03-22  717         int idx;
ada543459cab7f Stephane Eranian 2022-03-22  718  
ada543459cab7f Stephane Eranian 2022-03-22  719         amd_brs_enable_all();
ada543459cab7f Stephane Eranian 2022-03-22  720  
ada543459cab7f Stephane Eranian 2022-03-22  721         for (idx = 0; idx < 
x86_pmu.num_counters; idx++) {
ada543459cab7f Stephane Eranian 2022-03-22 @722                 hwc = 
&cpuc->events[idx]->hw;
ada543459cab7f Stephane Eranian 2022-03-22  723  
ada543459cab7f Stephane Eranian 2022-03-22  724                 /* only 
activate events which are marked as active */
ada543459cab7f Stephane Eranian 2022-03-22  725                 if 
(!test_bit(idx, cpuc->active_mask))
ada543459cab7f Stephane Eranian 2022-03-22  726                         
continue;
ada543459cab7f Stephane Eranian 2022-03-22  727  
ada543459cab7f Stephane Eranian 2022-03-22  728                 
amd_pmu_enable_event(cpuc->events[idx]);
ada543459cab7f Stephane Eranian 2022-03-22  729         }
ada543459cab7f Stephane Eranian 2022-03-22  730  }
ada543459cab7f Stephane Eranian 2022-03-22  731  

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