Skip to content

Commit

Permalink
powerpc/pseries: Add null property check to pseries_discover_pic()
Browse files Browse the repository at this point in the history
The return value of of_get_property() isn't checked before it is passed
to the strstr() function, if it happens that the return value is null
then this will result in a null pointer being dereferenced.

Add a check to see if the return value of of_get_property() is null and
if it is continue straight on to the next node.

Signed-off-by: Suraj Jitindar Singh <[email protected]>
Reviewed-by: Chris Smart <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
  • Loading branch information
sjitindarsingh authored and mpe committed May 11, 2016
1 parent 9e44754 commit b2ed059
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions arch/powerpc/platforms/pseries/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ static void __init pseries_discover_pic(void)

for_each_node_by_name(np, "interrupt-controller") {
typep = of_get_property(np, "compatible", NULL);
if (!typep)
continue;
if (strstr(typep, "open-pic")) {
pSeries_mpic_node = of_node_get(np);
ppc_md.init_IRQ = pseries_mpic_init_IRQ;
Expand Down

0 comments on commit b2ed059

Please sign in to comment.