linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][next] media: venus: core,pm: fix potential infinite loop
@ 2021-04-07 13:48 Colin King
  2021-05-26 19:03 ` patchwork-bot+linux-arm-msm
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2021-04-07 13:48 UTC (permalink / raw)
  To: Stanimir Varbanov, Andy Gross, Bjorn Andersson,
	Mauro Carvalho Chehab, Bryan O'Donoghue, linux-media,
	linux-arm-msm
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

The for-loop iterates with a u8 loop counter i and compares this
with the loop upper limit of res->resets_num which is an unsigned
int type.  There is a potential infinite loop if res->resets_num
is larger than the u8 loop counter i. Fix this by making the loop
counter the same type as res->resets_num.

Addresses-Coverity: ("Infinite loop")
Fixes: 3bca43585e22 ("media: venus: core,pm: Add handling for resets")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/media/platform/qcom/venus/pm_helpers.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c
index dfe3ee84eeb6..5c0a9aa23e83 100644
--- a/drivers/media/platform/qcom/venus/pm_helpers.c
+++ b/drivers/media/platform/qcom/venus/pm_helpers.c
@@ -868,7 +868,7 @@ static void vcodec_domains_put(struct venus_core *core)
 static int core_resets_reset(struct venus_core *core)
 {
 	const struct venus_resources *res = core->res;
-	unsigned char i;
+	unsigned int i;
 	int ret;
 
 	if (!res->resets_num)
@@ -893,7 +893,7 @@ static int core_resets_get(struct venus_core *core)
 {
 	struct device *dev = core->dev;
 	const struct venus_resources *res = core->res;
-	unsigned char i;
+	unsigned int i;
 	int ret;
 
 	if (!res->resets_num)
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH][next] media: venus: core,pm: fix potential infinite loop
  2021-04-07 13:48 [PATCH][next] media: venus: core,pm: fix potential infinite loop Colin King
@ 2021-05-26 19:03 ` patchwork-bot+linux-arm-msm
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+linux-arm-msm @ 2021-05-26 19:03 UTC (permalink / raw)
  To: Colin King; +Cc: linux-arm-msm

Hello:

This patch was applied to qcom/linux.git (refs/heads/for-next):

On Wed,  7 Apr 2021 14:48:31 +0100 you wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> The for-loop iterates with a u8 loop counter i and compares this
> with the loop upper limit of res->resets_num which is an unsigned
> int type.  There is a potential infinite loop if res->resets_num
> is larger than the u8 loop counter i. Fix this by making the loop
> counter the same type as res->resets_num.
> 
> [...]

Here is the summary with links:
  - [next] media: venus: core,pm: fix potential infinite loop
    https://git.kernel.org/qcom/c/999267d07240

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-26 19:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07 13:48 [PATCH][next] media: venus: core,pm: fix potential infinite loop Colin King
2021-05-26 19:03 ` patchwork-bot+linux-arm-msm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).