This is an automated email from the ASF dual-hosted git repository. janc pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit 868bd57a90df20e1246fef402aa63d1f9758a65b Author: Magdalena Kasenberg <magdalena.kasenb...@codecoup.pl> AuthorDate: Fri Feb 26 11:17:29 2021 +0100 sensors/tcs34725: Fix untrusted divisor Coverity issues 218750, 218752. --- hw/drivers/sensors/tcs34725/src/tcs34725.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/drivers/sensors/tcs34725/src/tcs34725.c b/hw/drivers/sensors/tcs34725/src/tcs34725.c index 6789491..fb8202b 100644 --- a/hw/drivers/sensors/tcs34725/src/tcs34725.c +++ b/hw/drivers/sensors/tcs34725/src/tcs34725.c @@ -852,7 +852,7 @@ tcs34725_calc_colortemp_lux(struct sensor_itf *itf, g_comp = scd->scd_g - scd->scd_ir; b_comp = scd->scd_b - scd->scd_ir; - scd->scd_cratio = (float)scd->scd_ir / (float)scd->scd_c; + scd->scd_cratio = scd->scd_c == 0 ? 1.0f : (float)scd->scd_ir / (float)scd->scd_c; scd->scd_saturation = ((256 - atime) > 63) ? 65535 : 1024 * (256 - atime);