1
0
forked from drath/libratbag

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 <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer
2018-09-13 11:44:50 +10:00
committed by Benjamin Tissoires
parent 42caf3bc94
commit 91dfc3477d

View File

@@ -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);