io: accel: kxcjk-1013: Fix iio_event_spec direction
PATCH 1/1 io: accel: kxcjk-1013: Fix iio_event_spec direction
Because IIO_EV_DIR_* are not bitmasks but enums, IIO_EV_DIR_RISING | IIO_EV_DIR_FALLING is not equal with IIO_EV_DIR_EITHER.
This could lead to potential misformatted sysfs attributes like:
* in_accel_x_thresh_(null)_en
* in_accel_x_thresh_(null)_period
* in_accel_x_thresh_(null)_value
or even memory corruption.
--- drivers/iio/accel/kxcjk-1013.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/accel/kxcjk-1013.c +1 -1
@@ -894,7 +894,7 @@ static const struct attribute_group kxcjk1013_attrs_group = {static const struct iio_event_spec kxcjk1013_event = { .type =IIO_EV_TYPE_THRESH , - .dir =IIO_EV_DIR_RISING |IIO_EV_DIR_FALLING , + .dir =IIO_EV_DIR_EITHER , .mask_separate =BIT (IIO_EV_INFO_VALUE ) |BIT (IIO_EV_INFO_ENABLE ) |BIT (IIO_EV_INFO_PERIOD )
Signature · 1 line
1.9.1
Jonathan Cameron
maintainerQuoted 10 lines · Daniel Baluta
Because IIO_EV_DIR_* are not bitmasks but enums,
IIO_EV_DIR_RISING|IIO_EV_DIR_FALLINGis not equal withIIO_EV_DIR_EITHER.This could lead to potential misformatted sysfs attributes like:
* in_accel_x_thresh_(null)_en
* in_accel_x_thresh_(null)_period
* in_accel_x_thresh_(null)_value
Quoted 4 lines
or even memory corruption.
Fixes b4b491c083 (iio: accel: kxcjk-1013: Support threshold)Signed-off-by Daniel Baluta <[email protected]>
Good catch. I'll have to hold this for a little until Greg takes my last pull request and I can bring the fixes branch up past the merge window.
Quoted 18 lines
--- drivers/iio/accel/kxcjk-1013.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/accel/kxcjk-1013.c +1
-1@@ -894,7 +894,7 @@ static const struct attribute_group kxcjk1013_attrs_group = {static const struct iio_event_spec kxcjk1013_event = { .type =IIO_EV_TYPE_THRESH , - .dir =IIO_EV_DIR_RISING |IIO_EV_DIR_FALLING , + .dir =IIO_EV_DIR_EITHER , .mask_separate =BIT (IIO_EV_INFO_VALUE ) |BIT (IIO_EV_INFO_ENABLE ) |BIT (IIO_EV_INFO_PERIOD )
Quoted 11 lines · Jonathan Cameron
Quoted 10 lines · Daniel Baluta
Because IIO_EV_DIR_* are not bitmasks but enums,
IIO_EV_DIR_RISING|IIO_EV_DIR_FALLINGis not equal withIIO_EV_DIR_EITHER.This could lead to potential misformatted sysfs attributes like:
* in_accel_x_thresh_(null)_en
* in_accel_x_thresh_(null)_period
* in_accel_x_thresh_(null)_value
Quoted 8 lines
Quoted 4 lines
or even memory corruption.
Fixes b4b491c083 (iio: accel: kxcjk-1013: Support threshold)Signed-off-by Daniel Baluta <[email protected]>Good catch. I'll have to hold this for a little until Greg takes my last pull request and I can bring the fixes branch up past the merge window.
Applied to the fixes-togreg branch of iio.git
Sorry for the delay,
Jonathan
Quoted 25 lines
Quoted 12 lines
--- drivers/iio/accel/kxcjk-1013.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/accel/kxcjk-1013.c +0
-0drivers/iio/accel/kxcjk-1013.c static const struct attribute_group kxcjk1013_attrs_group = { · line 900
Quoted 8 lines
drivers/iio/accel/kxcjk-1013.c +1
-1@@ -894,7 +894,7 @@ static const struct attribute_group kxcjk1013_attrs_group = {static const struct iio_event_spec kxcjk1013_event = { .type =IIO_EV_TYPE_THRESH , - .dir =IIO_EV_DIR_RISING |IIO_EV_DIR_FALLING , + .dir =IIO_EV_DIR_EITHER , .mask_separate =BIT (IIO_EV_INFO_VALUE ) |BIT (IIO_EV_INFO_ENABLE ) |BIT (IIO_EV_INFO_PERIOD )--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html