diff options
author | Patryk Duda <pdk@semihalf.com> | 2021-07-15 19:56:01 +0000 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-07-16 09:29:01 +0000 |
commit | a3eccacba9f7ba5a1053c31757f2791453fcdf24 (patch) | |
tree | d4e606fc3b0beabd14caec6256d364a162b52556 /driver/fingerprint | |
parent | 53d4e09122e556dd641733189d362ef163cd7610 (diff) | |
download | chrome-ec-a3eccacba9f7ba5a1053c31757f2791453fcdf24.tar.gz |
{bep, libfp}/fpc_private: Align enroll_ctx address to 4 bytes
Address of enroll_ctx array is provided to the FP library and under
some circumstances library can perform 4 byte load/store which needs
address to be 4 byte aligned.
This was found when debugging problem with skipped initialization
during fp_sensor_init(). Bio_sensor pointer was uninitialized, and when
enrollment was requested, FPMCU crashed. It looked like library was
performing 4 bytes access to enroll_ctx when bio_sensor was NULL.
BUG=b:170432597
BRANCH=none
TEST=make BOARD=dartmonkey
TEST=make BOARD=bloonchipper
Signed-off-by: Patryk Duda <pdk@semihalf.com>
Change-Id: I90b64d560448b4d737b09c706a636a567a3db943
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3033242
Reviewed-by: Craig Hesling <hesling@chromium.org>
Diffstat (limited to 'driver/fingerprint')
-rw-r--r-- | driver/fingerprint/fpc/bep/fpc_private.c | 2 | ||||
-rw-r--r-- | driver/fingerprint/fpc/libfp/fpc_private.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/driver/fingerprint/fpc/bep/fpc_private.c b/driver/fingerprint/fpc/bep/fpc_private.c index 0a405d4ad5..ae4b8d834b 100644 --- a/driver/fingerprint/fpc/bep/fpc_private.c +++ b/driver/fingerprint/fpc/bep/fpc_private.c @@ -19,7 +19,7 @@ #define CPRINTF(format, args...) cprintf(CC_FP, format, ## args) #define CPRINTS(format, args...) cprints(CC_FP, format, ## args) -static uint8_t enroll_ctx[FP_ALGORITHM_ENROLLMENT_SIZE] = {0}; +static uint8_t enroll_ctx[FP_ALGORITHM_ENROLLMENT_SIZE] __aligned(4) = {0}; /* Recorded error flags */ static uint16_t errors; diff --git a/driver/fingerprint/fpc/libfp/fpc_private.c b/driver/fingerprint/fpc/libfp/fpc_private.c index 623f110187..34fc61f66c 100644 --- a/driver/fingerprint/fpc/libfp/fpc_private.c +++ b/driver/fingerprint/fpc/libfp/fpc_private.c @@ -42,7 +42,7 @@ */ static uint8_t ctx[FP_SENSOR_CONTEXT_SIZE] __uncached __aligned(4); static bio_sensor_t bio_sensor; -static uint8_t enroll_ctx[FP_ALGORITHM_ENROLLMENT_SIZE]; +static uint8_t enroll_ctx[FP_ALGORITHM_ENROLLMENT_SIZE] __aligned(4); /* recorded error flags */ static uint16_t errors; |