[Skiboot] [RFC PATCH] hdata/paca: Check for dt_find_property() return value
Kamalesh Babulal
kamalesh at linux.vnet.ibm.com
Fri Jul 10 19:55:36 AEST 2015
dt_find_property() might return NULL. In __paca_parse(),
check for return value, before dereferencing it.
Also fix trailing white spaces.
Fixes Coverity defect#97842.
Signed-off-by: Kamalesh Babulal <kamalesh at linux.vnet.ibm.com>
---
hdata/paca.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/hdata/paca.c b/hdata/paca.c
index b0e6426..4f2006a 100644
--- a/hdata/paca.c
+++ b/hdata/paca.c
@@ -207,7 +207,7 @@ static bool __paca_parse(void)
paca = get_hdif(&spira.ntuples.paca, PACA_HDIF_SIG);
if (!paca) {
- prerror("Invalid PACA (PCIA = %p)\n",
+ prerror("Invalid PACA (PCIA = %p)\n",
ntuple_addr(&spira.ntuples.pcia));
return false;
}
@@ -299,6 +299,11 @@ static bool __paca_parse(void)
/* Add the cpu #. */
prop = dt_find_property(cpu, "ibm,ppc-interrupt-server#s");
+ if (!prop) {
+ prerror("CPU[%i]: could not find mapping information\n",
+ paca_index(paca));
+ return false;
+ }
num = prop->len / sizeof(u32);
new_prop = malloc((num + 1) * sizeof(u32));
if (!new_prop) {
@@ -317,7 +322,7 @@ static bool __paca_parse(void)
add_icps();
return true;
-}
+}
void paca_parse(void)
{
--
2.1.2
More information about the Skiboot
mailing list