Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: can: mcan: can_mcan_add_rx_filter() unconditionally adds offset for extended CAN-ID filters #44721

Closed
henrikbrixandersen opened this issue Apr 10, 2022 · 0 comments · Fixed by #44688
Assignees
Labels
area: CAN bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug

Comments

@henrikbrixandersen
Copy link
Member

henrikbrixandersen commented Apr 10, 2022

Describe the bug
The can_mcan_add_rx_filter() function unconditionally adds a NUM_STD_FILTER_DATA offset for extended CAN-ID filters, even if adding a filter returned -ENOSPC. This prevents correct error reporting when all extended CAN-ID filters are in use.

Expected behavior
The driver should correctly report -ENOSPC if no more filters are available.

Environment (please complete the following information):

  • OS: Ubuntu Linux 20.04 LTS
  • Toolchain Zephyr SDK v0.14.0
  • Commit SHA: 70c4841

Additional context
This was found during implementation of #44687.

@henrikbrixandersen henrikbrixandersen added bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug area: CAN labels Apr 10, 2022
@henrikbrixandersen henrikbrixandersen self-assigned this Apr 10, 2022
@henrikbrixandersen henrikbrixandersen changed the title drivers: can: mcan: can_mcan_add_rx_filter() unconditionally add offset for extended CAN-ID filters drivers: can: mcan: can_mcan_add_rx_filter() unconditionally adds offset for extended CAN-ID filters Apr 10, 2022
henrikbrixandersen added a commit to vestas-wind-systems/zephyr that referenced this issue Apr 10, 2022
Only add the filter ID offset for extended CAN-ID filters if the filter
was added successfully. Raise log level from info to warning if filter
addition failed but only log it once.

Fix bounds check for removing an extended CAN-ID filter.

Fixes: zephyrproject-rtos#44721

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
carlescufi pushed a commit that referenced this issue Apr 19, 2022
Only add the filter ID offset for extended CAN-ID filters if the filter
was added successfully. Raise log level from info to warning if filter
addition failed but only log it once.

Fix bounds check for removing an extended CAN-ID filter.

Fixes: #44721

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
ibaz-nordic pushed a commit to ibaz-nordic/zephyr that referenced this issue Apr 21, 2022
Only add the filter ID offset for extended CAN-ID filters if the filter
was added successfully. Raise log level from info to warning if filter
addition failed but only log it once.

Fix bounds check for removing an extended CAN-ID filter.

Fixes: zephyrproject-rtos#44721

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: CAN bug The issue is a bug, or the PR is fixing a bug priority: medium Medium impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant