* [PATCH v2] drm/bridge: sii902x: validate I2S data lane values
@ 2026-09-20 3:48 Pengpeng Hou
0 siblings, 0 replies; only message in thread
From: Pengpeng Hou @ 2026-09-20 3:48 UTC (permalink / raw)
To: andrzej.hajda
Cc: neil.armstrong, rfoss, laurent.pinchart, jonas, jernej.skrabec,
luca.ceresoli, maarten.lankhorst, mripard, tzimmermann, airlied,
simona, dri-devel, linux-kernel, hppiscas
The sil,i2s-data-lanes property reader bounds the number of entries, but
does not bound each entry's value. Those values index the four-entry
i2s_lane_id table when the audio FIFO sequence is built.
Reject unsupported lane values before indexing that table. Report the
property name and invalid value with dev_err_probe() so the diagnostic
identifies the faulty configuration.
The issue was found by our static-analysis tool.
Fixes: ff5781634c41 ("drm/bridge: sii902x: Implement HDMI audio support")
Assisted-by: gpt 5
Signed-off-by: Pengpeng Hou <hppiscas@163.com>
---
Changes since v1:
https://lore.kernel.org/all/2026063007056160.5-ccfa108-0046-drm-bridge-sii902x-validate-pengpeng@iscas.ac.cn/
Use dev_err_probe() and identify sil,i2s-data-lanes in the diagnostic,
as Luca requested; add the verified introducing Fixes tag.
drivers/gpu/drm/bridge/sii902x.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c
index 9aac44ed5b67..48058029fdfc 100644
--- a/drivers/gpu/drm/bridge/sii902x.c
+++ b/drivers/gpu/drm/bridge/sii902x.c
@@ -890,9 +890,15 @@ static int sii902x_audio_codec_init(struct sii902x *sii902x,
}
codec_data.max_i2s_channels = 2 * num_lanes;
- for (i = 0; i < num_lanes; i++)
+ for (i = 0; i < num_lanes; i++) {
+ if (lanes[i] >= ARRAY_SIZE(i2s_lane_id))
+ return dev_err_probe(dev, -EINVAL,
+ "invalid sil,i2s-data-lanes value %u\n",
+ lanes[i]);
+
sii902x->audio.i2s_fifo_sequence[i] |= audio_fifo_id[i] |
i2s_lane_id[lanes[i]] | SII902X_TPI_I2S_FIFO_ENABLE;
+ }
sii902x->audio.mclk = devm_clk_get_optional(dev, "mclk");
if (IS_ERR(sii902x->audio.mclk)) {
base-commit: 518e5b794c06c0f0eb40df3e202274a66202c137
--
2.50.1 (Apple Git-155)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-20 3:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-20 3:48 [PATCH v2] drm/bridge: sii902x: validate I2S data lane values Pengpeng Hou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®