summaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2021-04-07 15:48:31 +0200
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-04-15 13:12:35 +0200
commit999267d07240f0a9d8a85c0521b311331081b605 (patch)
tree5b23637596df283305e0e120af8c2b121eff1edd /drivers/media
parentc9072b674f76ef2c52fecda2ebd2e66c99c451ab (diff)
downloadlinux-999267d07240f0a9d8a85c0521b311331081b605.tar.bz2
media: venus: core,pm: fix potential infinite loop
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> Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/qcom/venus/pm_helpers.c4
1 files 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 @@ skip_pmdomains:
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)