Re: [PATCH 1/2] dyndbg: fix incorrect mod_ct value in dynamic_debug_init()
From: Andrew Morton
Date: Sat Aug 29 2026 - 23:23:15 EST
On Tue, 11 Aug 2026 20:18:30 +0800 Yuntao Wang <yuntao.wang@xxxxxxxxx> wrote:
> Suppose all `struct _ddebug` instances belong to the same module, mod_ct
> should be 1, but it is currently 0.
Oh. Why. Does
if (strcmp(modname, iter->modname)) {
not evaluate to true in this situation?
ie, more details please.
> Fix it.
What are the userspace-visible runtime effects of this bug?
Thanks.
> --- a/lib/dynamic_debug.c
> +++ b/lib/dynamic_debug.c
> @@ -1456,6 +1456,8 @@ static int __init dynamic_debug_init(void)
> iter_mod_start = iter;
> }
> }
> +
> + mod_ct++;
> di.num_descs = mod_sites;
> di.descs = iter_mod_start;
> ret = ddebug_add_module(&di, modname);
> --
> 2.55.0
>