From: Kang Chen <void0red@gmail.com>
To: konrad.dybcio@linaro.org
Cc: agross@kernel.org, andersson@kernel.org, ohad@wizery.com,
baolin.wang@linux.alibaba.com, linux-arm-msm@vger.kernel.org,
linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org,
Kang Chen <void0red@gmail.com>
Subject: [PATCH] hwspinlock: add a check of devm_regmap_field_alloc in qcom_hwspinlock_probe
Date: Sun, 26 Feb 2023 22:45:45 +0800 [thread overview]
Message-ID: <20230226144545.4187442-1-void0red@gmail.com> (raw)
devm_regmap_field_alloc may fails, priv field might be error pointer and
cause illegal address access later.
Signed-off-by: Kang Chen <void0red@gmail.com>
---
drivers/hwspinlock/qcom_hwspinlock.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/hwspinlock/qcom_hwspinlock.c b/drivers/hwspinlock/qcom_hwspinlock.c
index 9cf186362..b69d43d30 100644
--- a/drivers/hwspinlock/qcom_hwspinlock.c
+++ b/drivers/hwspinlock/qcom_hwspinlock.c
@@ -197,6 +197,8 @@ static int qcom_hwspinlock_probe(struct platform_device *pdev)
bank->lock[i].priv = devm_regmap_field_alloc(&pdev->dev,
regmap, field);
+ if (IS_ERR(bank->lock[i].priv)
+ return -ENOMEM;
}
return devm_hwspin_lock_register(&pdev->dev, bank, &qcom_hwspinlock_ops,
--
2.34.1
next reply other threads:[~2023-02-26 14:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-26 14:45 Kang Chen [this message]
2023-02-26 16:31 ` [PATCH] hwspinlock: add a check of devm_regmap_field_alloc in qcom_hwspinlock_probe kernel test robot
2023-02-26 16:42 ` kernel test robot
2023-02-27 0:41 ` [PATCH v2] " Kang Chen
2023-07-15 22:13 ` Bjorn Andersson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230226144545.4187442-1-void0red@gmail.com \
--to=void0red@gmail.com \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=konrad.dybcio@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=ohad@wizery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox