If strdup() returns NULL, find_devtree() just return NULL to
indicate this function execute failed.

Signed-off-by: Wenchao Hao <[email protected]>
Signed-off-by: Zhiqiang Liu <[email protected]>
Signed-off-by: Wu Bo <[email protected]>
---
 utils/fwparam_ibft/fwparam_ppc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/utils/fwparam_ibft/fwparam_ppc.c b/utils/fwparam_ibft/fwparam_ppc.c
index b5eaa00..25d4532 100644
--- a/utils/fwparam_ibft/fwparam_ppc.c
+++ b/utils/fwparam_ibft/fwparam_ppc.c
@@ -76,6 +76,9 @@ static char *find_devtree(const char *filename)
         * /chosen.
         */
 
+       if (!devtree)
+               return NULL;
+
        chop_at = strstr(devtree, "/chosen");
        if (!chop_at)
                chop_at = strstr(devtree, "/aliases");
-- 
2.27.0

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/open-iscsi/20201207015410.48488-9-haowenchao%40huawei.com.

Reply via email to