sys/can: annotate functions with ACCESS()#22382
Open
maribu wants to merge 2 commits into
Open
Conversation
Use the `ACCESS()` macro to annotate functions so that GCC can provide better diagnostics for `-Wstringop-overflow`.
mguetschow
approved these changes
Jun 15, 2026
Member
Author
|
Adding the one |
crasbe
reviewed
Jun 15, 2026
crasbe
left a comment
Contributor
There was a problem hiding this comment.
I don't want to go all out again, but maybe we can use the opportunity to reduce the long-line static-test debt a bit 😅
| } | ||
|
|
||
| static int register_filter_entry(can_reg_entry_t *entry, struct can_filter *filter, void *param) | ||
| static int register_filter_entry(can_reg_entry_t *entry, const struct can_filter *filter, void *param) |
Contributor
There was a problem hiding this comment.
Suggested change
| static int register_filter_entry(can_reg_entry_t *entry, const struct can_filter *filter, void *param) | |
| static int register_filter_entry(can_reg_entry_t *entry, | |
| const struct can_filter *filter, void *param) |
| } | ||
|
|
||
| static int unregister_filter_entry(can_reg_entry_t *entry, struct can_filter *filter, void *param) | ||
| static int unregister_filter_entry(can_reg_entry_t *entry, const struct can_filter *filter, void *param) |
Contributor
There was a problem hiding this comment.
Suggested change
| static int unregister_filter_entry(can_reg_entry_t *entry, const struct can_filter *filter, void *param) | |
| static int unregister_filter_entry(can_reg_entry_t *entry, | |
| const struct can_filter *filter, void *param) |
| } | ||
|
|
||
| int raw_can_subscribe_rx(int ifnum, struct can_filter *filter, kernel_pid_t pid, void *param) | ||
| int raw_can_subscribe_rx(int ifnum, const struct can_filter *filter, kernel_pid_t pid, void *param) |
Contributor
There was a problem hiding this comment.
Suggested change
| int raw_can_subscribe_rx(int ifnum, const struct can_filter *filter, kernel_pid_t pid, void *param) | |
| int raw_can_subscribe_rx(int ifnum, const struct can_filter *filter, | |
| kernel_pid_t pid, void *param) |
|
|
||
| #ifdef MODULE_CAN_MBOX | ||
| int raw_can_subscribe_rx_mbox(int ifnum, struct can_filter *filter, mbox_t *mbox, void *param) | ||
| int raw_can_subscribe_rx_mbox(int ifnum, const struct can_filter *filter, mbox_t *mbox, void *param) |
Contributor
There was a problem hiding this comment.
Suggested change
| int raw_can_subscribe_rx_mbox(int ifnum, const struct can_filter *filter, mbox_t *mbox, void *param) | |
| int raw_can_subscribe_rx(int ifnum, const struct can_filter *filter, | |
| kernel_pid_t pid, void *param) |
|
|
||
| #ifdef MODULE_CAN_MBOX | ||
| int raw_can_unsubscribe_rx_mbox(int ifnum, struct can_filter *filter, mbox_t *mbox, void *param) | ||
| int raw_can_unsubscribe_rx_mbox(int ifnum, const struct can_filter *filter, mbox_t *mbox, void *param) |
Contributor
There was a problem hiding this comment.
Suggested change
| int raw_can_unsubscribe_rx_mbox(int ifnum, const struct can_filter *filter, mbox_t *mbox, void *param) | |
| int raw_can_unsubscribe_rx_mbox(int ifnum, const struct can_filter *filter, | |
| mbox_t *mbox, void *param) |
| * @return < 0 on error | ||
| */ | ||
| int raw_can_subscribe_rx(int ifnum, struct can_filter *filter, kernel_pid_t pid, void *param); | ||
| int raw_can_subscribe_rx(int ifnum, const struct can_filter *filter, kernel_pid_t pid, void *param); |
Contributor
There was a problem hiding this comment.
Suggested change
| int raw_can_subscribe_rx(int ifnum, const struct can_filter *filter, kernel_pid_t pid, void *param); | |
| int raw_can_subscribe_rx(int ifnum, const struct can_filter *filter, | |
| kernel_pid_t pid, void *param); |
Comment on lines
82
to
83
| * This function must be called if a user thread @p pid wants to receive the CAN frame matching @p filter | ||
| * on the interface @p ifnum. |
Contributor
There was a problem hiding this comment.
Suggested change
| * This function must be called if a user thread @p pid wants to receive the | |
| * CAN frame matching @p filter on the interface @p ifnum. |
| * | ||
| * This function must be called if a user thread waiting on @p mbox wants to receive | ||
| * the CAN frame matching @p filter on the interface @p ifnum. | ||
| * The user thread will then receive msg via mailbox IPC on reception of frame matching @p filters. |
Contributor
There was a problem hiding this comment.
Suggested change
| * The user thread will then receive msg via mailbox IPC on reception of | |
| * frame matching @p filters. |
Comment on lines
252
to
254
| * @return 0 on success | ||
| * @return 1 if the bitrate/sample_point couple can not be reached precisely but the bitrate is set | ||
| * @return < 0 on error |
Contributor
There was a problem hiding this comment.
Suggested change
| * @retval 0 on success | |
| * @retval 1 if the bitrate/sample_point couple can not be reached precisely | |
| * but the bitrate is set | |
| * @retval <0 on error |
| * @param[in] master the master connection | ||
| * @param[in,out] slave the slave connection to initialize | ||
| */ | ||
| static inline void conn_can_isotp_init_slave(conn_can_isotp_t *master, conn_can_isotp_slave_t *slave) |
Contributor
There was a problem hiding this comment.
Suggested change
| static inline void conn_can_isotp_init_slave(conn_can_isotp_t *master, | |
| conn_can_isotp_slave_t *slave) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contribution description
Use the
ACCESS()macro to annotate functions so that GCC can provide better diagnostics for-Wstringop-overflow.Testing procedure
The CI will do this
Issues/PRs references
#22380
Declaration of AI-Tools / LLMs usage:
Same as in #22380