[Skiboot] [PATCH] [paca] Fix NULL pointer dereference
Ananth N Mavinakayanahalli
ananth at in.ibm.com
Thu Jun 18 18:11:52 AEST 2015
On Thu, Jun 18, 2015 at 11:16:27AM +0530, Vasant Hegde wrote:
> On 06/16/2015 04:36 PM, Ananth N Mavinakayanahalli wrote:
> > Fix NULL pointer dereference in paca.c
> >
> > Signed-off-by: Ananth N Mavinakayanahalli <ananth at in.ibm.com>
> > ---
> > hdata/paca.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/hdata/paca.c b/hdata/paca.c
> > index d4360e7..d188819 100644
> > --- a/hdata/paca.c
> > +++ b/hdata/paca.c
> > @@ -158,6 +158,9 @@ static void add_icps(void)
> > const struct sppaca_cpu_id *id;
> > id = HDIF_get_idata(paca, SPPACA_IDATA_CPU_ID, &size);
> >
> > + if (id == NULL)
> > + continue;
>
> Ananth,
>
> It works .. But I think its better to use CHECK_SPPTR macro. (of course there
> are several places where we just checking for NULL).
Agreed. Sent v2
> Also I see similar issues in one or two other places like hdata/memory.c
The only place where such a dereference is done without a check has an
explicit callout that the pointers are valid there; I agree, it doesn't
hurt to be a tad defensive.
Ananth
More information about the Skiboot
mailing list