[PATCH] drm/bridge: tc358767: fix uninitialized variable regression

Luca Ceresoli posted 1 patch 3 months ago
There is a newer version of this series
drivers/gpu/drm/bridge/tc358767.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] drm/bridge: tc358767: fix uninitialized variable regression
Posted by Luca Ceresoli 3 months ago
Commit a59a27176914 ("drm/bridge: tc358767: convert to
devm_drm_bridge_alloc() API") split tc_probe_bridge_endpoint() in two
functions, thus duplicating the loop over the endpoints in each of those
functions. However it missed duplicating the of_graph_parse_endpoint() call
which initializes the struct of_endpoint, resulting in an uninitialized
read.

Fixes: a59a27176914 ("drm/bridge: tc358767: convert to devm_drm_bridge_alloc() API")
Reported-by: Colin King (gmail) <colin.i.king@gmail.com>
Closes: https://lore.kernel.org/all/056b34c3-c1ea-4b8c-9672-c98903ffd012@gmail.com056b34c3-c1ea-4b8c-9672-c98903ffd012@gmail.com
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
---
 drivers/gpu/drm/bridge/tc358767.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c
index 61559467e2d22b4b1b4223c97766ca3bf58908fd..562fea47b3ecf360e64a414e95ab5d645e610e9e 100644
--- a/drivers/gpu/drm/bridge/tc358767.c
+++ b/drivers/gpu/drm/bridge/tc358767.c
@@ -2422,6 +2422,7 @@ static int tc_probe_bridge_endpoint(struct tc_data *tc, enum tc_mode mode)
 	struct device_node *node = NULL;
 
 	for_each_endpoint_of_node(dev->of_node, node) {
+		of_graph_parse_endpoint(node, &endpoint);
 		if (endpoint.port == 2) {
 			of_property_read_u8_array(node, "toshiba,pre-emphasis",
 						  tc->pre_emphasis,

---
base-commit: b4cd18f485687a2061ee7a0ce6833851fc4438da
change-id: 20250703-drm-bridge-alloc-fix-tc358767-regression-536ea2861af6

Best regards,
-- 
Luca Ceresoli <luca.ceresoli@bootlin.com>
Re: [PATCH] drm/bridge: tc358767: fix uninitialized variable regression
Posted by Colin King (gmail) 3 months ago
On 03/07/2025 17:32, Luca Ceresoli wrote:
> Commit a59a27176914 ("drm/bridge: tc358767: convert to
> devm_drm_bridge_alloc() API") split tc_probe_bridge_endpoint() in two
> functions, thus duplicating the loop over the endpoints in each of those
> functions. However it missed duplicating the of_graph_parse_endpoint() call
> which initializes the struct of_endpoint, resulting in an uninitialized
> read.
> 
> Fixes: a59a27176914 ("drm/bridge: tc358767: convert to devm_drm_bridge_alloc() API")
> Reported-by: Colin King (gmail) <colin.i.king@gmail.com>
> Closes: https://lore.kernel.org/all/056b34c3-c1ea-4b8c-9672-c98903ffd012@gmail.com056b34c3-c1ea-4b8c-9672-c98903ffd012@gmail.com
> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
> ---
>   drivers/gpu/drm/bridge/tc358767.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c
> index 61559467e2d22b4b1b4223c97766ca3bf58908fd..562fea47b3ecf360e64a414e95ab5d645e610e9e 100644
> --- a/drivers/gpu/drm/bridge/tc358767.c
> +++ b/drivers/gpu/drm/bridge/tc358767.c
> @@ -2422,6 +2422,7 @@ static int tc_probe_bridge_endpoint(struct tc_data *tc, enum tc_mode mode)
>   	struct device_node *node = NULL;
>   
>   	for_each_endpoint_of_node(dev->of_node, node) {
> +		of_graph_parse_endpoint(node, &endpoint);
>   		if (endpoint.port == 2) {
>   			of_property_read_u8_array(node, "toshiba,pre-emphasis",
>   						  tc->pre_emphasis,
> 
> ---
> base-commit: b4cd18f485687a2061ee7a0ce6833851fc4438da
> change-id: 20250703-drm-bridge-alloc-fix-tc358767-regression-536ea2861af6
> 
> Best regards,

Looks good to me. Thanks Luca.

Reviewed-by: Colin Ian King <colin.i.king@gmail.com>

Re: [PATCH] drm/bridge: tc358767: fix uninitialized variable regression
Posted by Luca Ceresoli 3 months ago
On Thu, 3 Jul 2025 19:00:44 +0100
"Colin King (gmail)" <colin.i.king@gmail.com> wrote:

> On 03/07/2025 17:32, Luca Ceresoli wrote:
> > Commit a59a27176914 ("drm/bridge: tc358767: convert to
> > devm_drm_bridge_alloc() API") split tc_probe_bridge_endpoint() in two
> > functions, thus duplicating the loop over the endpoints in each of those
> > functions. However it missed duplicating the of_graph_parse_endpoint() call
> > which initializes the struct of_endpoint, resulting in an uninitialized
> > read.
> > 
> > Fixes: a59a27176914 ("drm/bridge: tc358767: convert to devm_drm_bridge_alloc() API")
> > Reported-by: Colin King (gmail) <colin.i.king@gmail.com>
> > Closes: https://lore.kernel.org/all/056b34c3-c1ea-4b8c-9672-c98903ffd012@gmail.com056b34c3-c1ea-4b8c-9672-c98903ffd012@gmail.com

Dang, broken URL. I could not check it because lore was down when I
sent the patch.

Ignore this patch, sending v2.

> Reviewed-by: Colin Ian King <colin.i.king@gmail.com>

Thanks,
Luca

-- 
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com