All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com
Subject: [tip:perf/core 3/5] arch/x86/events/intel/uncore_discovery.c:194:61: warning: Parameter 'ignore' can be declared as pointer to const [constParameter]
Date: Sat, 28 Jan 2023 22:38:20 +0800	[thread overview]
Message-ID: <202301282213.5SIgJMDD-lkp@intel.com> (raw)

:::::: 
:::::: Manual check reason: "low confidence static check warning: arch/x86/events/intel/uncore_discovery.c:194:61: warning: Parameter 'ignore' can be declared as pointer to const [constParameter]"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
CC: x86@kernel.org
TO: Kan Liang <kan.liang@linux.intel.com>
CC: Peter Zijlstra <peterz@infradead.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core
head:   5d515ee40cb57ea5331998f27df7946a69f14dc3
commit: bd9514a4d5ec25b29728720ca8b3a9ac4e3137d7 [3/5] perf/x86/uncore: Ignore broken units in discovery table
:::::: branch date: 8 days ago
:::::: commit date: 8 days ago
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (cppcheck warning):
        # apt-get install cppcheck
        git checkout bd9514a4d5ec25b29728720ca8b3a9ac4e3137d7
        cppcheck --quiet --enable=style,performance,portability --template=gcc FILE

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>


cppcheck possible warnings: (new ones prefixed by >>, may not real problems)

>> arch/x86/events/intel/uncore_discovery.c:194:61: warning: Parameter 'ignore' can be declared as pointer to const [constParameter]
   uncore_ignore_unit(struct uncore_unit_discovery *unit, int *ignore)
                                                               ^
--
>> arch/x86/events/intel/uncore_snbep.c:3904:32: warning: Parameter 'ag' can be declared as pointer to const [constParameter]
          struct attribute_group *ag)
                                  ^
>> arch/x86/events/intel/uncore_snbep.c:4709:69: warning: Parameter 'sad_pmon_mapping' can be declared as pointer to const [constParameter]
   static int sad_cfg_iio_topology(struct intel_uncore_type *type, u8 *sad_pmon_mapping)
                                                                       ^
>> arch/x86/events/intel/uncore_snbep.c:1159:17: warning: Shifting signed 32-bit value by 31 bits is implementation-defined behaviour [shiftTooManyBitsSigned]
    .event_mask  = SNBEP_PCU_MSR_PMON_RAW_EVENT_MASK,
                   ^
   arch/x86/events/intel/uncore_snbep.c:1824:17: warning: Shifting signed 32-bit value by 31 bits is implementation-defined behaviour [shiftTooManyBitsSigned]
    .event_mask  = IVBEP_PCU_MSR_PMON_RAW_EVENT_MASK,
                   ^
   arch/x86/events/intel/uncore_snbep.c:2256:17: warning: Shifting signed 32-bit value by 31 bits is implementation-defined behaviour [shiftTooManyBitsSigned]
    .event_mask  = KNL_PCU_MSR_PMON_RAW_EVENT_MASK,
                   ^
   arch/x86/events/intel/uncore_snbep.c:2875:17: warning: Shifting signed 32-bit value by 31 bits is implementation-defined behaviour [shiftTooManyBitsSigned]
    .event_mask  = SNBEP_PCU_MSR_PMON_RAW_EVENT_MASK,
                   ^
   arch/x86/events/intel/uncore_snbep.c:4169:17: warning: Shifting signed 32-bit value by 31 bits is implementation-defined behaviour [shiftTooManyBitsSigned]
    .event_mask  = SNBEP_PCU_MSR_PMON_RAW_EVENT_MASK,
                   ^
>> arch/x86/events/intel/uncore_snbep.c:1140:46: warning: Either the condition 'ev_sel<=0xe' is redundant or there is signed integer overflow for expression '0xff<<(reg1->idx*8)'. [integerOverflowCond]
     reg1->config = event->attr.config1 & (0xff << (reg1->idx * 8));
                                                ^
   arch/x86/events/intel/uncore_snbep.c:1137:30: note: Assuming that condition 'ev_sel<=0xe' is not redundant
    if (ev_sel >= 0xb && ev_sel <= 0xe) {
                                ^
   arch/x86/events/intel/uncore_snbep.c:1139:13: note: reg1->idx is assigned 'ev_sel-0xb' here.
     reg1->idx = ev_sel - 0xb;
               ^
   arch/x86/events/intel/uncore_snbep.c:1140:46: note: Integer overflow
     reg1->config = event->attr.config1 & (0xff << (reg1->idx * 8));
                                                ^
>> arch/x86/events/intel/uncore_snbep.c:1159:17: warning: Signed integer overflow for expression '1<<31'. [integerOverflow]
    .event_mask  = SNBEP_PCU_MSR_PMON_RAW_EVENT_MASK,
                   ^
   arch/x86/events/intel/uncore_snbep.c:1824:17: warning: Signed integer overflow for expression '1<<31'. [integerOverflow]
    .event_mask  = IVBEP_PCU_MSR_PMON_RAW_EVENT_MASK,
                   ^
   arch/x86/events/intel/uncore_snbep.c:2256:17: warning: Signed integer overflow for expression '1<<31'. [integerOverflow]
    .event_mask  = KNL_PCU_MSR_PMON_RAW_EVENT_MASK,
                   ^
   arch/x86/events/intel/uncore_snbep.c:2875:17: warning: Signed integer overflow for expression '1<<31'. [integerOverflow]
    .event_mask  = SNBEP_PCU_MSR_PMON_RAW_EVENT_MASK,
                   ^
   arch/x86/events/intel/uncore_snbep.c:4012:17: warning: Signed integer overflow for expression '0xff<<24'. [integerOverflow]
    .event_mask  = SKX_IIO_PMON_RAW_EVENT_MASK,
                   ^
   arch/x86/events/intel/uncore_snbep.c:4169:17: warning: Signed integer overflow for expression '1<<31'. [integerOverflow]
    .event_mask  = SNBEP_PCU_MSR_PMON_RAW_EVENT_MASK,
                   ^
   arch/x86/events/intel/uncore_snbep.c:5007:16: warning: Signed integer overflow for expression '0xff<<24'. [integerOverflow]
    .event_mask = SKX_IIO_PMON_RAW_EVENT_MASK,
                  ^
>> arch/x86/events/intel/uncore_snbep.c:4352:9: warning: Uninitialized variable: ret [uninitvar]
    return ret;
           ^
   arch/x86/events/intel/uncore_snbep.c:4339:20: note: Assuming condition is false
    for (idx = 0; idx < type->num_boxes; idx++) {
                      ^
   arch/x86/events/intel/uncore_snbep.c:4352:9: note: Uninitialized variable: ret
    return ret;
           ^

vim +/ignore +194 arch/x86/events/intel/uncore_discovery.c

edae1f06c2cda4 Kan Liang 2021-03-17  192  
bd9514a4d5ec25 Kan Liang 2023-01-12  193  static bool
bd9514a4d5ec25 Kan Liang 2023-01-12 @194  uncore_ignore_unit(struct uncore_unit_discovery *unit, int *ignore)
bd9514a4d5ec25 Kan Liang 2023-01-12  195  {
bd9514a4d5ec25 Kan Liang 2023-01-12  196  	int i;
bd9514a4d5ec25 Kan Liang 2023-01-12  197  
bd9514a4d5ec25 Kan Liang 2023-01-12  198  	if (!ignore)
bd9514a4d5ec25 Kan Liang 2023-01-12  199  		return false;
bd9514a4d5ec25 Kan Liang 2023-01-12  200  
bd9514a4d5ec25 Kan Liang 2023-01-12  201  	for (i = 0; ignore[i] != UNCORE_IGNORE_END ; i++) {
bd9514a4d5ec25 Kan Liang 2023-01-12  202  		if (unit->box_type == ignore[i])
bd9514a4d5ec25 Kan Liang 2023-01-12  203  			return true;
bd9514a4d5ec25 Kan Liang 2023-01-12  204  	}
bd9514a4d5ec25 Kan Liang 2023-01-12  205  
bd9514a4d5ec25 Kan Liang 2023-01-12  206  	return false;
bd9514a4d5ec25 Kan Liang 2023-01-12  207  }
bd9514a4d5ec25 Kan Liang 2023-01-12  208  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

                 reply	other threads:[~2023-01-28 14:38 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202301282213.5SIgJMDD-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=oe-kbuild@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.