From 91dfc3477d7b995bced4ad351942de026c1f2e95 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 13 Sep 2018 11:44:50 +1000 Subject: [PATCH] driver-hidpp10: fix a coverity complaint Coverity seems to think this can use uninitialized array elements but that can only happen when hidpp10->dpi_count is 0. In which case the callee doesn't touch it anyway but coverity doesn't care about that bit. Signed-off-by: Peter Hutterer --- src/driver-hidpp10.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/driver-hidpp10.c b/src/driver-hidpp10.c index 42c632c5..992f8487 100644 --- a/src/driver-hidpp10.c +++ b/src/driver-hidpp10.c @@ -453,8 +453,8 @@ hidpp10drv_read_profile(struct ratbag_profile *profile) /* FIXME: this relies on libratbag using the * same steps that we support */ ratbag_resolution_set_dpi_list_from_range(res, min, max); - } else { - for (int i = 0; i < hidpp10->dpi_count; i++) + } else if (hidpp10->dpi_count > 0) { + for (uint8_t i = 0; i < hidpp10->dpi_count; i++) dpis[i] = hidpp10->dpi_table[i].dpi; ratbag_resolution_set_dpi_list(res, dpis, hidpp10->dpi_count);