Skip to content

event_timeout: check clock before removing ztimer on clear #16667

Merged
miri64 merged 2 commits intoRIOT-OS:masterfrom
miri64:event_timeout/bug/check-clock-on-clear
Jul 21, 2021
Merged

event_timeout: check clock before removing ztimer on clear #16667
miri64 merged 2 commits intoRIOT-OS:masterfrom
miri64:event_timeout/bug/check-clock-on-clear

Conversation

@miri64
Copy link
Copy Markdown
Member

@miri64 miri64 commented Jul 21, 2021

Contribution description

Currently, event_timeout_clear() crashes when used with ztimer and when the timeout is uninitialized. This isn't the same behavior as with xtimer. As such, check the clock variable (which when set to NULL causes the crash) before clearing the timer.

Testing procedure

tests/event should pass. When the fix is reverted, it crashes.

Issues/PRs references

None.

@miri64 miri64 added the Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) label Jul 21, 2021
@miri64 miri64 added the Area: timers Area: timer subsystems label Jul 21, 2021
@github-actions github-actions bot added Area: sys Area: System Area: tests Area: tests and testing framework and removed Area: timers Area: timer subsystems labels Jul 21, 2021
@miri64 miri64 added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: run tests If set, CI server will run tests on hardware for the labeled PR labels Jul 21, 2021
Copy link
Copy Markdown
Contributor

@fjmolinas fjmolinas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK, although I believe that it's normal that if an object is used uninitialized then any operation on such object could lead to errors.

@miri64
Copy link
Copy Markdown
Member Author

miri64 commented Jul 21, 2021

ACK, although I believe that it's normal that if an object is used uninitialized then any operation on such object could lead to errors.

Well, the alternative would be that for the ztimer part I would have to have added the if around clear in #16668. Otherwise, the test application crashes ;-).

@miri64 miri64 merged commit 184501b into RIOT-OS:master Jul 21, 2021
@miri64 miri64 deleted the event_timeout/bug/check-clock-on-clear branch July 21, 2021 13:37
@benpicco benpicco added this to the Release 2021.10 milestone Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: sys Area: System Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: run tests If set, CI server will run tests on hardware for the labeled PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants