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: flash: flash_mcux_flexspi_nor incorrectly handles border case #87021

Open
Laczen opened this issue Mar 13, 2025 · 4 comments
Open

drivers: flash: flash_mcux_flexspi_nor incorrectly handles border case #87021

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

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.

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
Projects
None yet
Development

No branches or pull requests

5 participants