Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [Low] Missing prototype declaration warning (-Wmissing-prototypes) when 
CONFIG_KUNIT is enabled but CONFIG_TLOB_KUNIT_TEST is disabled.
--

--- Patch [7]: [PATCH v5 7/9] rv: Add KUnit tests for the tlob monitor ---
commit c187567361217a017982494c7c6e1a3021a25452
Author: Wen Yang <[email protected]>

rv: Add KUnit tests for the tlob monitor

This commit adds a KUnit test suite for the tlob monitor's uprobe-line
parsers. It modifies tlob_parse_uprobe_line and tlob_parse_remove_line
to be visible and exported when testing is enabled.

> diff --git a/kernel/trace/rv/monitors/tlob/tlob.c 
> b/kernel/trace/rv/monitors/tlob/tlob.c
> index 99acd34726f10..e109390ba3ada 100644
> --- a/kernel/trace/rv/monitors/tlob/tlob.c
> +++ b/kernel/trace/rv/monitors/tlob/tlob.c
> @@ -874,7 +874,7 @@ static ssize_t tlob_monitor_read(struct file *file,
>   * PATH may contain ':'; the last ':' separates path from offset.
>   * Returns 0, -EINVAL, or -ERANGE.
>   */
> -static int tlob_parse_uprobe_line(char *buf, u64 *thr_out,
> +VISIBLE_IF_KUNIT int tlob_parse_uprobe_line(char *buf, u64 *thr_out,
>                                           char **path_out,
>                                           loff_t *start_out, loff_t *stop_out)

[ ... ]

> diff --git a/kernel/trace/rv/monitors/tlob/tlob.h 
> b/kernel/trace/rv/monitors/tlob/tlob.h
> index 94e7382c2130b..6ad9d5179ab60 100644
> --- a/kernel/trace/rv/monitors/tlob/tlob.h
> +++ b/kernel/trace/rv/monitors/tlob/tlob.h
> @@ -146,4 +146,10 @@ static const struct automaton_tlob automaton_tlob = {
>  /* Upper budget bound (1 hour): keeps the u64 ns accumulators far from 
> overflow. */
>  #define TLOB_MAX_THRESHOLD_NS        3600000000000ULL
>  
> +#if IS_ENABLED(CONFIG_TLOB_KUNIT_TEST)
> +int tlob_parse_uprobe_line(char *buf, u64 *thr_out, char **path_out,
> +                        loff_t *start_out, loff_t *stop_out);
> +int tlob_parse_remove_line(char *buf, char **path_out, loff_t *start_out);
> +#endif /* CONFIG_TLOB_KUNIT_TEST */

[Severity: Low]
Will this cause a missing-prototypes build warning when CONFIG_KUNIT is
enabled but CONFIG_TLOB_KUNIT_TEST is disabled?

In tlob.c, VISIBLE_IF_KUNIT drops the static keyword whenever CONFIG_KUNIT
is enabled, making the functions global.

However, the prototype declarations here in tlob.h are strictly gated
behind CONFIG_TLOB_KUNIT_TEST.

If a kernel is built with CONFIG_KUNIT=y but CONFIG_TLOB_KUNIT_TEST=n, the
functions become global without a visible prototype, which will trigger
-Wmissing-prototypes build errors. Should this IS_ENABLED() check use
CONFIG_KUNIT instead to match the visibility macro?

> +
>  #endif /* _RV_TLOB_H */

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=7

Reply via email to