Skip to content

FDC2x1x driver contains critical memory access issues #90790

@TylerBird

Description

@TylerBird

Describe the bug

I wanted to use the TI sensor fdc2x1x (onboard I have a FDC2214). The driver is also available. After integration, the controller did not start and I received a “fatal exception” error.

Image

First, I had an ESP32 (board: M5StickC-plus, flashed via UART), then I tried it with an STM32L552 (flashed via STLink V3) controller.

After ruling out the app code as the source of the error, I took a look at the driver. Here I discovered memory access violations.
For example, here:
Note the variable access cfg->ch_cfg->fin_sel which is channel specific and therefore must be implemented as follows: cfg->ch_cfg-[ch].fin_sel.

Image

I have noticed 3 of these access violations.

Furthermore, I use the chip without the sd_gpio.
In the code, however, the function fdc2x1x_init(const struct device *dev) incorrectly checks whether this has been set in the device tree.

Here is what helped me:
if (cfg->sd_gpio.port->name) { -> if (cfg->sd_gpio.port) {

Regression

  • This is a regression.

Steps to reproduce

Execute the example from the folder samples/sensor/fdc2x1x.

Relevant log output

Impact

Annoyance – Minor irritation; no significant impact on usability or functionality.

Environment

  • Linux Ubuntu
  • Zephyr SDK with VSCode
  • zephyrproject-rtos with revision: v4.1.0-rc3

Additional Context

No response

Metadata

Metadata

Labels

Stalearea: SensorsSensorsbugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions