[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170315114357.14446-2-j.neuschaefer@gmx.net>
Date: Wed, 15 Mar 2017 12:43:57 +0100
From: Jonathan Neuschäfer <j.neuschaefer@....net>
To: linux-arm-msm@...r.kernel.org
Cc: Bjorn Andersson <bjorn.andersson@...aro.org>,
linux-soc@...r.kernel.org, Andy Gross <andy.gross@...aro.org>,
David Brown <david.brown@...aro.org>,
linux-kernel@...r.kernel.org,
Jonathan Neuschäfer <j.neuschaefer@....net>
Subject: [PATCH 2/2] soc: qcom: smsm: Avoid the use of an uninitialized value
If qcom_smem_get returns an error besides -EPROBE_DEFER or -ENOENT,
don't assume that size has been set.
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@....net>
---
drivers/soc/qcom/smsm.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/soc/qcom/smsm.c b/drivers/soc/qcom/smsm.c
index 3918645e5708..632c060c9cc0 100644
--- a/drivers/soc/qcom/smsm.c
+++ b/drivers/soc/qcom/smsm.c
@@ -441,7 +441,8 @@ static int smsm_get_size_info(struct qcom_smsm *smsm)
info = qcom_smem_get(QCOM_SMEM_HOST_ANY, SMEM_SMSM_SIZE_INFO, &size);
if (PTR_ERR(info) == -EPROBE_DEFER) {
return PTR_ERR(info);
- } else if (PTR_ERR(info) == -ENOENT || size != sizeof(*info)) {
+ } else if (PTR_ERR(info) == -ENOENT ||
+ (!IS_ERR(info) && size != sizeof(*info))) {
dev_warn(smsm->dev, "no smsm size info, using defaults\n");
smsm->num_entries = SMSM_DEFAULT_NUM_ENTRIES;
smsm->num_hosts = SMSM_DEFAULT_NUM_HOSTS;
--
2.11.0
Powered by blists - more mailing lists