diff options
author | Suraj Jitindar Singh <sjitindarsingh@gmail.com> | 2016-04-28 01:53:45 -0400 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2016-05-11 07:54:03 -0400 |
commit | b2ed059642875a699a195cb136b2e57e7e07cedf (patch) | |
tree | ad8207f829dd1c14f473f78fdf67518271b303c6 /arch/powerpc/platforms/pseries/setup.c | |
parent | 9e44754755528f78dbc3a5e64cd48dadf4773777 (diff) |
powerpc/pseries: Add null property check to pseries_discover_pic()
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 <sjitindarsingh@gmail.com>
Reviewed-by: Chris Smart <chris@distroguy.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/platforms/pseries/setup.c')
-rw-r--r-- | arch/powerpc/platforms/pseries/setup.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index 6e944fc6e5f9..fa734943bcbc 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c | |||
@@ -235,6 +235,8 @@ static void __init pseries_discover_pic(void) | |||
235 | 235 | ||
236 | for_each_node_by_name(np, "interrupt-controller") { | 236 | for_each_node_by_name(np, "interrupt-controller") { |
237 | typep = of_get_property(np, "compatible", NULL); | 237 | typep = of_get_property(np, "compatible", NULL); |
238 | if (!typep) | ||
239 | continue; | ||
238 | if (strstr(typep, "open-pic")) { | 240 | if (strstr(typep, "open-pic")) { |
239 | pSeries_mpic_node = of_node_get(np); | 241 | pSeries_mpic_node = of_node_get(np); |
240 | ppc_md.init_IRQ = pseries_mpic_init_IRQ; | 242 | ppc_md.init_IRQ = pseries_mpic_init_IRQ; |