[bug report] powerpc/perf: Add nest IMC PMU support

2 messages, 2 authors, 2018-10-24 · open the first message on its own page

[bug report] powerpc/perf: Add nest IMC PMU support

From: Dan Carpenter <hidden>
Date: 2018-10-18 09:36:21

Hello Anju T Sudhakar,

The patch 885dcd709ba9: "powerpc/perf: Add nest IMC PMU support" from
Jul 19, 2017, leads to the following static checker warning:

	arch/powerpc/perf/imc-pmu.c:506 nest_imc_event_init()
	warn: 'pcni' can't be NULL.

arch/powerpc/perf/imc-pmu.c
   485          if (event->cpu < 0)
   486                  return -EINVAL;
   487  
   488          pmu = imc_event_to_pmu(event);
   489  
   490          /* Sanity check for config (event offset) */
   491          if ((config & IMC_EVENT_OFFSET_MASK) > pmu->counter_mem_size)
   492                  return -EINVAL;
   493  
   494          /*
   495           * Nest HW counter memory resides in a per-chip reserve-memory (HOMER).
   496           * Get the base memory addresss for this cpu.
   497           */
   498          chip_id = cpu_to_chip_id(event->cpu);
   499          pcni = pmu->mem_info;
                ^^^^^^^^^^^^^^^^^^^^
   500          do {
   501                  if (pcni->id == chip_id) {
   502                          flag = true;
   503                          break;
   504                  }
   505                  pcni++;
                        ^^^^^^
   506          } while (pcni);
                         ^^^^
This will loop until we crash.  I'm not sure what was intended.

   507  
   508          if (!flag)
   509                  return -ENODEV;
   510  

regards,
dan carpenter

Re: [bug report] powerpc/perf: Add nest IMC PMU support

From: Anju T Sudhakar <hidden>
Date: 2018-10-24 07:08:08

Hi,


On 10/18/18 3:03 PM, Dan Carpenter wrote:
Hello Anju T Sudhakar,

The patch 885dcd709ba9: "powerpc/perf: Add nest IMC PMU support" from
Jul 19, 2017, leads to the following static checker warning:

	arch/powerpc/perf/imc-pmu.c:506 nest_imc_event_init()
	warn: 'pcni' can't be NULL.
Unfortunately this warning didn't appear when I checked with smatch.

Could you please provide the steps to reproduce this?

This is the commit id with which I build smatch: commit 
79fe36620a7a3a45d1a51d62238da250fb8db920

But anyway I am looking into the code part. Thanks for mentioning this.

I will update soon.


Thanks,

Anju


Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help