hardware/libsensors
修订版 | 168c15b9a7e045eeaa24a9dcfd61ee9ec364410d (tree) |
---|---|
时间 | 2019-07-02 12:55:43 |
作者 | Chih-Wei Huang <cwhuang@linu...> |
Commiter | Chih-Wei Huang |
kbdsensor: fix uninitialized error
Initialize the struct sensors_poll_device_1 to zero, otherwise some
members may have unexpected value which causes crashing.
@@ -48,6 +48,7 @@ template <typename T> struct SensorFd : T { | ||
48 | 48 | |
49 | 49 | template <typename T> SensorFd<T>::SensorFd(const struct hw_module_t *module) |
50 | 50 | { |
51 | + memset(this, 0, sizeof(*this)); | |
51 | 52 | this->common.tag = HARDWARE_DEVICE_TAG; |
52 | 53 | this->common.version = SENSORS_DEVICE_API_VERSION_1_3; |
53 | 54 | this->common.module = const_cast<struct hw_module_t *>(module); |