[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250731160109.1547131-1-simont@opensource.cirrus.com>
Date: Thu, 31 Jul 2025 16:01:09 +0000
From: Simon Trimmer <simont@...nsource.cirrus.com>
To: broonie@...nel.org
Cc: linux-spi@...r.kernel.org, linux-sound@...r.kernel.org,
linux-kernel@...r.kernel.org, patches@...nsource.cirrus.com,
Simon Trimmer <simont@...nsource.cirrus.com>
Subject: [PATCH] spi: cs42l43: Property entry should be a null-terminated array
The software node does not specify a count of property entries, so the
array must be null-terminated.
When unterminated, this can lead to a fault in the downstream cs35l56
amplifier driver, because the node parse walks off the end of the
array into unknown memory.
Fixes: 0ca645ab5b15 ("spi: cs42l43: Add speaker id support to the bridge configuration")
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220371
Signed-off-by: Simon Trimmer <simont@...nsource.cirrus.com>
---
drivers/spi/spi-cs42l43.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/spi/spi-cs42l43.c b/drivers/spi/spi-cs42l43.c
index b28a840b3b04..14307dd800b7 100644
--- a/drivers/spi/spi-cs42l43.c
+++ b/drivers/spi/spi-cs42l43.c
@@ -295,7 +295,7 @@ static struct spi_board_info *cs42l43_create_bridge_amp(struct cs42l43_spi *priv
struct spi_board_info *info;
if (spkid >= 0) {
- props = devm_kmalloc(priv->dev, sizeof(*props), GFP_KERNEL);
+ props = devm_kcalloc(priv->dev, 2, sizeof(*props), GFP_KERNEL);
if (!props)
return NULL;
--
2.43.0
Powered by blists - more mailing lists