From: Kang Chen <void0red@gmail.com>
To: lkp@intel.com
Cc: agross@kernel.org, andersson@kernel.org,
baolin.wang@linux.alibaba.com, konrad.dybcio@linaro.org,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-remoteproc@vger.kernel.org, llvm@lists.linux.dev,
oe-kbuild-all@lists.linux.dev, ohad@wizery.com,
void0red@gmail.com
Subject: [PATCH v2] hwspinlock: add a check of devm_regmap_field_alloc in qcom_hwspinlock_probe
Date: Mon, 27 Feb 2023 08:41:16 +0800 [thread overview]
Message-ID: <20230227004116.1273988-1-void0red@gmail.com> (raw)
In-Reply-To: <202302270034.DqtDwv49-lkp@intel.com>
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>
---
v2 -> v1: add missing parenthesis and switch to use PTR_ERR
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..dee7bb5ea 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 PTR_ERR(bank->lock[i].priv);
}
return devm_hwspin_lock_register(&pdev->dev, bank, &qcom_hwspinlock_ops,
--
2.34.1
next prev parent reply other threads:[~2023-02-27 0:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-26 14:45 [PATCH] hwspinlock: add a check of devm_regmap_field_alloc in qcom_hwspinlock_probe Kang Chen
2023-02-26 16:31 ` kernel test robot
2023-02-26 16:42 ` kernel test robot
2023-02-27 0:41 ` Kang Chen [this message]
2023-07-15 22:13 ` [PATCH v2] " 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=20230227004116.1273988-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=lkp@intel.com \
--cc=llvm@lists.linux.dev \
--cc=oe-kbuild-all@lists.linux.dev \
--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