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

Check that SYST.set_reload's argument is valid #511

Open
Ecco opened this issue Feb 2, 2024 · 1 comment
Open

Check that SYST.set_reload's argument is valid #511

Ecco opened this issue Feb 2, 2024 · 1 comment

Comments

@Ecco
Copy link

Ecco commented Feb 2, 2024

The SYST.set_reload takes a number of cycles as an argument. Even though the type of this argument is an u32, only values that fit on 24 bits are valid. The code does document this caveat, however in practice there is no check being enforced.

As a result, it's very easy to pass a value that's too large and that will silently overflow, leading to a hard-to-diagnose incorrect behavior.

Would it make sense to add an assertion about the argument there?

@Ecco Ecco changed the title Assert that SYST.set_reload's argument is valid Check that SYST.set_reload's argument is valid Feb 2, 2024
@newAM
Copy link
Member

newAM commented Jun 30, 2024

The discussion about handling out-of-range inputs has been happening in the WG meetings and rust-embedded/riscv#212

Cortex-M should adopt whatever comes out of that for a similar experience across architectures as @romancardenas suggested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants