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/yas_orientation.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/yas_orientation.c')
-rw-r--r-- | libsensors/yas_orientation.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/libsensors/yas_orientation.c b/libsensors/yas_orientation.c index 3668d8b..c14ed72 100644 --- a/libsensors/yas_orientation.c +++ b/libsensors/yas_orientation.c @@ -191,13 +191,12 @@ int yas_orientation_deactivate(struct piranha_sensors_handlers *handlers) return 0; } -int yas_orientation_set_delay(struct piranha_sensors_handlers *handlers, long int delay) +int yas_orientation_set_delay(struct piranha_sensors_handlers *handlers, int64_t delay) { struct yas_orientation_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; @@ -214,11 +213,11 @@ int yas_orientation_set_delay(struct piranha_sensors_handlers *handlers, long in data->magnetic_sensor->set_delay(data->magnetic_sensor, delay); 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; |