Fix some null pointer dereference flaw and parameter not init issues.
change-Id: I0ed5f3f62c3794775bf97d353c4e50dd8ceb32da
Signed-off-by: Yao Jiang <yaojia@codeaurora.org>
const char *client_id_str;
client_id_str = of_get_property(node, "qcom,client-id", &len);
- if (len != CLIENT_ID_LEN_IN_CHARS) {
+ if (!client_id_str || len != CLIENT_ID_LEN_IN_CHARS) {
DBG("client_id_str len(%d) is invalid\n", len);
ret = -EINVAL;
} else {
-/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
}
revid_data = get_revid_data(revid_dev_node);
- if (IS_ERR(revid_data)) {
+ if (IS_ERR_OR_NULL(revid_data)) {
pr_debug("revid error rc = %ld\n", PTR_ERR(revid_data));
return -EINVAL;
}
penv->smmu_iova_start,
penv->smmu_iova_len);
if (IS_ERR(mapping)) {
- pr_err("%s: create mapping failed, err = %d\n", __func__, ret);
ret = PTR_ERR(mapping);
+ pr_err("%s: create mapping failed, err = %d\n", __func__, ret);
goto map_fail;
}
* This check is also necessary for ensuring page poisoning
* works as expected when enabled
*/
- if (!section->page_ext)
+ if (!section || !section->page_ext)
return NULL;
return section->page_ext + pfn;
}