From: Xuewen Yan <xuewen.yan@unisoc.com>
To: <lukasz.luba@arm.com>, <rafael@kernel.org>, <pavel@kernel.org>,
<lenb@kernel.org>
Cc: <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<xuewen.yan94@gmail.com>, <ke.wang@unisoc.com>
Subject: [RFC PATCH 2/2] PM: EM: Validate new_table in em_dev_update_perf_domain()
Date: Fri, 10 Jul 2026 16:24:47 +0800 [thread overview]
Message-ID: <20260710082447.5160-2-xuewen.yan@unisoc.com> (raw)
In-Reply-To: <20260710082447.5160-1-xuewen.yan@unisoc.com>
Add an explicit check for the new_table parameter in
em_dev_update_perf_domain() to ensure it is not NULL or an
ERR_PTR before proceeding with the update.
Signed-off-by: Xuewen Yan <xuewen.yan@unisoc.com>
---
kernel/power/energy_model.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/power/energy_model.c b/kernel/power/energy_model.c
index 277aaf1b19da..4d75e1b3c20e 100644
--- a/kernel/power/energy_model.c
+++ b/kernel/power/energy_model.c
@@ -331,7 +331,7 @@ int em_dev_update_perf_domain(struct device *dev,
struct em_perf_table *old_table;
struct em_perf_domain *pd;
- if (!dev)
+ if (!dev || IS_ERR_OR_NULL(new_table))
return -EINVAL;
/* Serialize update/unregister or concurrent updates */
--
2.25.1
next prev parent reply other threads:[~2026-07-10 8:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-10 8:24 [RFC PATCH 1/2] PM: EM: Export em_table_alloc/free Xuewen Yan
2026-07-10 8:24 ` Xuewen Yan [this message]
2026-07-10 8:36 ` [RFC PATCH 2/2] PM: EM: Validate new_table in em_dev_update_perf_domain() Lukasz Luba
2026-07-10 8:34 ` [RFC PATCH 1/2] PM: EM: Export em_table_alloc/free Lukasz Luba
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=20260710082447.5160-2-xuewen.yan@unisoc.com \
--to=xuewen.yan@unisoc.com \
--cc=ke.wang@unisoc.com \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=pavel@kernel.org \
--cc=rafael@kernel.org \
--cc=xuewen.yan94@gmail.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