2019-10-04 08:15:01

by Yizhuo Zhai

[permalink] [raw]
Subject: Potential uninitialized variables in pwm: stm32-lp

Hi All:

drivers/pwm/pwm-stm32-lp.c:

Variable "val" and "prd" in function stm32_pwm_lp_get_state() could be
uninitialized
if regmap_read() returns -EINVAL. But it's directly used later without
the return check,
which is potentially unsafe.

Also, we cannot simply return -EINVAL in stm32_pwm_lp_get_state() because the
return type is void.

Thanks for your time to check this case.
--
Kind Regards,

Yizhuo Zhai

Computer Science, Graduate Student
University of California, Riverside