Skip to content

drivers: flash: flash_mcux_flexspi_nor incorrectly handles border case #87021

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

Closed
Laczen opened this issue Mar 13, 2025 · 5 comments · Fixed by #90706
Closed

drivers: flash: flash_mcux_flexspi_nor incorrectly handles border case #87021

Laczen opened this issue Mar 13, 2025 · 5 comments · Fixed by #90706
Assignees
Labels
bug The issue is a bug, or the PR is fixing a bug platform: NXP NXP priority: low Low impact/importance bug Stale

Comments

@Laczen
Copy link
Collaborator

Laczen commented Mar 13, 2025

Describe the bug

#84899 introduced input parameter checking for flash read operations.

The introduced check incorrectly handles the corner case where a read is performed of size 0 into a NULL array. The read fails with error code -EINVAL.

This introduces a difference between platforms when e.g. nvs_read is used to retrieve the size of an already stored element as reported in #86981.

To Reproduce

See #86981.

Expected behavior

No difference between platforms.

Logs and console output

See #86981.

Environment (please complete the following information):

See #86981.

@Laczen Laczen added the bug The issue is a bug, or the PR is fixing a bug label Mar 13, 2025
@JordanYates
Copy link
Collaborator

I think you transposed some numbers in those issues, I doubt the reproduction case is a LoRa PR :)

@Laczen
Copy link
Collaborator Author

Laczen commented Mar 13, 2025

I think you transposed some numbers in those issues, I doubt the reproduction case is a LoRa PR :)

Updated, thanks :)

@dleach02
Copy link
Member

@Laczen do you have a recommended fix?

@dleach02 dleach02 added the priority: low Low impact/importance bug label Mar 14, 2025
@Laczen
Copy link
Collaborator Author

Laczen commented Mar 14, 2025

@Laczen do you have a recommended fix?

Return 0 when the read/write length is 0 before checking the read/write buffer.

Copy link

This issue has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this issue will automatically be closed in 14 days. Note, that you can always re-open a closed issue at any time.

@github-actions github-actions bot added the Stale label May 14, 2025
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 28, 2025
dleach02 added a commit to nxp-upstream/zephyr that referenced this issue May 28, 2025
Parameter checking of flash read API expects checking for len == 0
before checking dest buffer validation.

Fixes zephyrproject-rtos#87021

Signed-off-by: David Leach <david.leach@nxp.com>
dleach02 added a commit to nxp-upstream/zephyr that referenced this issue May 28, 2025
Parameter checking of flash read API expects checking for len == 0
before checking dest buffer validation.

Fixes zephyrproject-rtos#87021

Signed-off-by: David Leach <david.leach@nxp.com>
kartben pushed a commit that referenced this issue May 30, 2025
Parameter checking of flash read API expects checking for len == 0
before checking dest buffer validation.

Fixes #87021

Signed-off-by: David Leach <david.leach@nxp.com>
Shreyas-Shankar155 pushed a commit to MihiraMadhava/zephyr that referenced this issue Jun 3, 2025
Parameter checking of flash read API expects checking for len == 0
before checking dest buffer validation.

Fixes zephyrproject-rtos#87021

Signed-off-by: David Leach <david.leach@nxp.com>
JiafeiPan pushed a commit to nxp-upstream/zephyr that referenced this issue Jun 4, 2025
Parameter checking of flash read API expects checking for len == 0
before checking dest buffer validation.

Fixes zephyrproject-rtos#87021

Signed-off-by: David Leach <david.leach@nxp.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug, or the PR is fixing a bug platform: NXP NXP priority: low Low impact/importance bug Stale
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants