Message ID | 1505117637-16460-1-git-send-email-maddy@linux.vnet.ibm.com |
---|---|
State | Accepted |
Headers | show |
Series | skiboot/hw/imc: Add NULL pointer check | expand |
Madhavan Srinivasan <maddy@linux.vnet.ibm.com> writes: > Minor cleanup to avoid null pointer access. > > Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com> > --- > hw/imc.c | 4 ++++ > 1 file changed, 4 insertions(+) Thanks, merged to master as of 8782c0da7243fb6c608e6a00fd90957423832481
diff --git a/hw/imc.c b/hw/imc.c index 3db67a2a9d34..ccf3973c4752 100644 --- a/hw/imc.c +++ b/hw/imc.c @@ -599,6 +599,8 @@ static int64_t opal_imc_counters_start(uint32_t type, uint64_t cpu_pir) case OPAL_IMC_COUNTERS_NEST: /* Fetch the IMC control block structure */ cb = get_imc_cb(c->chip_id); + if (!cb) + return OPAL_HARDWARE; /* Set the run command */ op = NEST_IMC_ENABLE; @@ -651,6 +653,8 @@ static int64_t opal_imc_counters_stop(uint32_t type, uint64_t cpu_pir) case OPAL_IMC_COUNTERS_NEST: /* Fetch the IMC control block structure */ cb = get_imc_cb(c->chip_id); + if (!cb) + return OPAL_HARDWARE; /* Set the run command */ op = NEST_IMC_DISABLE;
Minor cleanup to avoid null pointer access. Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com> --- hw/imc.c | 4 ++++ 1 file changed, 4 insertions(+)