[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250226030930.20574-1-jiashengjiangcool@gmail.com>
Date: Wed, 26 Feb 2025 03:09:30 +0000
From: Jiasheng Jiang <jiashengjiangcool@...il.com>
To: jiri@...nulli.us
Cc: arkadiusz.kubalewski@...el.com,
davem@...emloft.net,
jan.glaza@...el.com,
jiashengjiangcool@...il.com,
linux-kernel@...r.kernel.org,
netdev@...r.kernel.org,
przemyslaw.kitszel@...el.com,
stable@...r.kernel.org,
vadim.fedorenko@...ux.dev
Subject: [PATCH v2] dpll: Add an assertion to check freq_supported_num
Since the driver is broken in the case that src->freq_supported is not
NULL but src->freq_supported_num is 0, add an assertion for it.
Fixes: 830ead5fb0c5 ("dpll: fix pin dump crash for rebound module")
Cc: <stable@...r.kernel.org> # v6.8+
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@...il.com>
---
Changelog:
v1 -> v2:
1. Replace the check with an assertion.
---
drivers/dpll/dpll_core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/dpll/dpll_core.c b/drivers/dpll/dpll_core.c
index 32019dc33cca..3296776c1ebb 100644
--- a/drivers/dpll/dpll_core.c
+++ b/drivers/dpll/dpll_core.c
@@ -443,8 +443,9 @@ static void dpll_pin_prop_free(struct dpll_pin_properties *prop)
static int dpll_pin_prop_dup(const struct dpll_pin_properties *src,
struct dpll_pin_properties *dst)
{
+ BUG_ON(src->freq_supported && !src->freq_supported_num);
memcpy(dst, src, sizeof(*dst));
- if (src->freq_supported && src->freq_supported_num) {
+ if (src->freq_supported) {
size_t freq_size = src->freq_supported_num *
sizeof(*src->freq_supported);
dst->freq_supported = kmemdup(src->freq_supported,
--
2.25.1
Powered by blists - more mailing lists