diff options
| author | Dhoat Harpal <hdhoat@codeaurora.org> | 2017-01-16 19:08:09 +0530 |
|---|---|---|
| committer | Arun Kumar Neelakantam <aneela@codeaurora.org> | 2017-01-19 11:48:38 +0530 |
| commit | 81b13dfb6863271cbce496a231f28743afea7ff9 (patch) | |
| tree | 30c7abb2431451a44660c6eba9bb343449f5e3f2 | |
| parent | a51b7f60003e6071703d5e4489dae0f3ab7ae264 (diff) | |
soc: qcom: smem: Fix possible use of uninitialized variable
Usage of uninitialized variable remote_host happens if common partition
header hosts value dont match with TOC values.
Add common partition check and error log if hosts mismatch with TOC.
CRs-Fixed: 1113351
Change-Id: I15f8823751abccf87c55e570a8a762bfb2cfb2df
Signed-off-by: Dhoat Harpal <hdhoat@codeaurora.org>
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
| -rw-r--r-- | drivers/soc/qcom/msm_smem.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/soc/qcom/msm_smem.c b/drivers/soc/qcom/msm_smem.c index 9c4d89ac704d..d3f44ab75f67 100644 --- a/drivers/soc/qcom/msm_smem.c +++ b/drivers/soc/qcom/msm_smem.c @@ -1222,12 +1222,18 @@ static void smem_init_security_partition(struct smem_toc_entry *entry, LOG_ERR("Smem partition %d cached heap exceeds size\n", num); BUG(); } - if (hdr->host0 == SMEM_COMM_HOST && hdr->host1 == SMEM_COMM_HOST) { - comm_partition.partition_num = num; - comm_partition.offset = entry->offset; - comm_partition.size_cacheline = entry->size_cacheline; - SMEM_INFO("Common Partition %d offset:%x\n", num, - entry->offset); + if (is_comm_partition) { + if (hdr->host0 == SMEM_COMM_HOST + && hdr->host1 == SMEM_COMM_HOST) { + comm_partition.partition_num = num; + comm_partition.offset = entry->offset; + comm_partition.size_cacheline = entry->size_cacheline; + SMEM_INFO("Common Partition %d offset:%x\n", num, + entry->offset); + } else { + LOG_ERR("Smem Comm partition hosts don't match TOC\n"); + WARN_ON(1); + } return; } if (hdr->host0 != SMEM_APPS && hdr->host1 != SMEM_APPS) { |
