* [PATCH drm-next] drm/bridge: it6505: Fix unreachable loop increment in KSV list check
@ 2025-01-07 11:07 Dheeraj Reddy Jonnalagadda
2025-01-08 2:08 ` Dmitry Baryshkov
0 siblings, 1 reply; 2+ messages in thread
From: Dheeraj Reddy Jonnalagadda @ 2025-01-07 11:07 UTC (permalink / raw)
To: andrzej.hajda, neil.armstrong, rfoss
Cc: Laurent.pinchart, jonas, jernej.skrabec, maarten.lankhorst,
mripard, tzimmermann, airlied, simona, dri-devel, linux-kernel,
Dheeraj Reddy Jonnalagadda
The inner loop in it6505_hdcp_part2_ksvlist_check had an unreachable
increment due to returning true before the loop could continue.
Restructure the loop to only return after verifying all 5 entries
match, making the loop increment reachable.
Fixes: 0989c02c7a5c ("drm/bridge: it6505: fix HDCP CTS compare V matching")
Closes: https://scan7.scan.coverity.com/#/project-view/52337/11354?selectedIssue=1602785
Signed-off-by: Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@gmail.com>
---
drivers/gpu/drm/bridge/ite-it6505.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
index 88ef76a37fe6..2ff2245abdeb 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -2255,8 +2255,10 @@ static bool it6505_hdcp_part2_ksvlist_check(struct it6505 *it6505)
av[i][1] != av[i][2] || bv[i][0] != av[i][3])
break;
- DRM_DEV_DEBUG_DRIVER(dev, "V' all match!! %d, %d", retry, i);
- return true;
+ if (i == 4) {
+ DRM_DEV_DEBUG_DRIVER(dev, "V' all match!! %d, %d", retry, i);
+ return true;
+ }
}
}
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH drm-next] drm/bridge: it6505: Fix unreachable loop increment in KSV list check
2025-01-07 11:07 [PATCH drm-next] drm/bridge: it6505: Fix unreachable loop increment in KSV list check Dheeraj Reddy Jonnalagadda
@ 2025-01-08 2:08 ` Dmitry Baryshkov
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Baryshkov @ 2025-01-08 2:08 UTC (permalink / raw)
To: Dheeraj Reddy Jonnalagadda
Cc: andrzej.hajda, neil.armstrong, rfoss, Laurent.pinchart, jonas,
jernej.skrabec, maarten.lankhorst, mripard, tzimmermann, airlied,
simona, dri-devel, linux-kernel
On Tue, Jan 07, 2025 at 04:37:40PM +0530, Dheeraj Reddy Jonnalagadda wrote:
> The inner loop in it6505_hdcp_part2_ksvlist_check had an unreachable
> increment due to returning true before the loop could continue.
> Restructure the loop to only return after verifying all 5 entries
> match, making the loop increment reachable.
>
> Fixes: 0989c02c7a5c ("drm/bridge: it6505: fix HDCP CTS compare V matching")
> Closes: https://scan7.scan.coverity.com/#/project-view/52337/11354?selectedIssue=1602785
> Signed-off-by: Dheeraj Reddy Jonnalagadda <dheeraj.linuxdev@gmail.com>
> ---
> drivers/gpu/drm/bridge/ite-it6505.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
> index 88ef76a37fe6..2ff2245abdeb 100644
> --- a/drivers/gpu/drm/bridge/ite-it6505.c
> +++ b/drivers/gpu/drm/bridge/ite-it6505.c
> @@ -2255,8 +2255,10 @@ static bool it6505_hdcp_part2_ksvlist_check(struct it6505 *it6505)
> av[i][1] != av[i][2] || bv[i][0] != av[i][3])
> break;
>
> - DRM_DEV_DEBUG_DRIVER(dev, "V' all match!! %d, %d", retry, i);
> - return true;
> + if (i == 4) {
> + DRM_DEV_DEBUG_DRIVER(dev, "V' all match!! %d, %d", retry, i);
> + return true;
> + }
I think, it's more idiomatic if you move it out of the loop.
> }
> }
>
> --
> 2.34.1
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-01-08 2:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-07 11:07 [PATCH drm-next] drm/bridge: it6505: Fix unreachable loop increment in KSV list check Dheeraj Reddy Jonnalagadda
2025-01-08 2:08 ` Dmitry Baryshkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox