diff options
author | Christian Balster <christian.balster@gmail.com> | 2015-06-15 21:10:09 +0200 |
---|---|---|
committer | Andreas Blaesius <skate4life@gmx.de> | 2015-08-15 14:22:24 -0700 |
commit | 469a3ddad4fc39451250b3bf5b8417c3ca930289 (patch) | |
tree | 633ff1a2c808bf7ecbb522ba1e6a46fda9fea982 /libsensors/yas530.c | |
parent | f3ef9365e9c5e902cde345826a8260bba05a2676 (diff) | |
download | device_samsung_espressowifi-469a3ddad4fc39451250b3bf5b8417c3ca930289.zip device_samsung_espressowifi-469a3ddad4fc39451250b3bf5b8417c3ca930289.tar.gz device_samsung_espressowifi-469a3ddad4fc39451250b3bf5b8417c3ca930289.tar.bz2 |
espresso-common: libsensors: fix buffer overflows
long/int can't hold timestamp values in ns, use int64_t instead
Change-Id: Id3e08a45aa556d8858b8b57d03c3b737e999772d
Diffstat (limited to 'libsensors/yas530.c')
-rw-r--r-- | libsensors/yas530.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/libsensors/yas530.c b/libsensors/yas530.c index 81ff60d..b9b0e91 100644 --- a/libsensors/yas530.c +++ b/libsensors/yas530.c @@ -152,13 +152,12 @@ int yas530_deactivate(struct piranha_sensors_handlers *handlers) return 0; } -int yas530_set_delay(struct piranha_sensors_handlers *handlers, long int delay) +int yas530_set_delay(struct piranha_sensors_handlers *handlers, int64_t delay) { struct yas530_data *data; - int d; int rc; - ALOGD("%s(%p, %ld)", __func__, handlers, delay); + ALOGD("%s(%p, %" PRId64 ")", __func__, handlers, delay); if (handlers == NULL || handlers->data == NULL) return -EINVAL; @@ -166,11 +165,11 @@ int yas530_set_delay(struct piranha_sensors_handlers *handlers, long int delay) data = (struct yas530_data *) handlers->data; if (delay < 10000000) - d = 10; + delay = 10; else - d = delay / 1000000; + delay /= 1000000; - rc = sysfs_value_write(data->path_delay, d); + rc = sysfs_value_write(data->path_delay, delay); if (rc < 0) { ALOGE("%s: Unable to write sysfs value", __func__); return -1; |