Re: [PATCH] platform/chrome: sensorhub: Fix dropped timestamp events and log spam
Tzung-Bi Shih <[email protected]> Tue, 14 Jul 2026 11:54:57 +0000
| Newsgroups | dev.linux.lists.chrome-platform |
|---|---|
| Message-ID | <[email protected]> |
On Tue, Jul 14, 2026 at 06:52:02AM +0000, Tzung-Bi Shih wrote:
> Commit 833740a2333c ("platform/chrome: sensorhub: Bound the EC-reported
> sensor number") evaluated the `sensor_num` against the bounds limit even
> for timestamp events. A timestamp event typically has a `sensor_num` of
> 0xff [1], causing the driver to flag it as invalid and skip to the next
> event.
>
> As a result, we'd see a flooding of "Invalid sensor number 255 from EC"
> warning logs and these timestamp events were being dropped.
>
> Additionally, the firmware only ORs the tablet mode flag [2] onto
> timestamp events. Because the firmware strictly generates standalone
> timestamps (without other flags like ODR or FLUSH), bypassing the bounds
> check for anything containing the TIMESTAMP flag is safe and avoids
> invalid array access.
>
> Skip the bounds check for events carrying the
> MOTIONSENSE_SENSOR_FLAG_TIMESTAMP flag.
Please disregard the patch. We found this just opens another door for
malfunctioned or compromised firmware to access the array `batch_state`
out of bound. Will fix it in v2.