platform: msm: resolve NULL pointer dereference issue

Fix some null pointer dereference flaw and parameter not init issues.

change-Id: I0ed5f3f62c3794775bf97d353c4e50dd8ceb32da
Signed-off-by: Yao Jiang <yaojia@codeaurora.org>
This commit is contained in:
Yao Jiang 2018-08-13 12:20:57 +08:00
parent 6d92c598ae
commit ac44aac0b2
4 changed files with 5 additions and 5 deletions

View file

@ -318,7 +318,7 @@ static int _msm_parse_dt(struct device_node *node, u32 *client_id)
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 {

View file

@ -1,4 +1,4 @@
/* 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
@ -1726,7 +1726,7 @@ int qpnp_adc_get_revid_version(struct device *dev)
}
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;
}

View file

@ -1481,8 +1481,8 @@ static int cnss_smmu_init(struct device *dev)
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;
}

View file

@ -187,7 +187,7 @@ struct page_ext *lookup_page_ext(struct page *page)
* 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;
}