diff options
| author | Yuntao Wang <yuntao.wang@linux.dev> | 2026-08-11 20:18:30 +0800 |
|---|---|---|
| committer | Andrew Morton <akpm@linux-foundation.org> | 2026-10-08 23:06:55 -0700 |
| commit | 02bff67ad36518498b055fe2a90291f38ca540e9 (patch) | |
| tree | 5278cb67a62d0e69b7667b0a51db195c4878448c /tools/lib/python/kdoc/parse_data_structs.py | |
| parent | a3b1823252a746de20632e58b47ac036148ef514 (diff) | |
| download | linux-next-02bff67ad36518498b055fe2a90291f38ca540e9.tar.gz linux-next-02bff67ad36518498b055fe2a90291f38ca540e9.zip | |
dyndbg: fix incorrect mod_ct value in dynamic_debug_init()
Patch series "dyndbg: fix incorrect mod_ct value in dynamic_debug_init()".
Fix and clean up dynamic_debug_init().
This patch (of 2):
Suppose all `struct _ddebug` instances belong to the same module, mod_ct
should be 1, but it is currently 0.
mod_ct is incremented only when iter->modname changes, i.e. when the loop
encounters the first _ddebug entry of a new module:
if (strcmp(modname, iter->modname)) {
mod_ct++;
...
}
If all _ddebug entries belong to the same module, strcmp() never returns
nonzero, so mod_ct remains 0.
However, the last (and in this case only) module is added after the loop:
di.num_descs = mod_sites;
di.descs = iter_mod_start;
ret = ddebug_add_module(&di, modname);
Thus, mod_ct should be incremented before adding this final module.
The bug only affects the diagnostic message printed by vpr_info():
"%d prdebugs in %d modules, ..."
It reports one fewer module than the actual number of modules. There is
no userspace-visible runtime effect; the dynamic debug tables themselves
are initialized correctly.
Fix it.
Link: https://lore.kernel.org/20260811121831.577848-1-yuntao.wang@linux.dev
Link: https://lore.kernel.org/20260811121831.577848-2-yuntao.wang@linux.dev
Signed-off-by: Yuntao Wang <yuntao.wang@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Jason Baron <jbaron@akamai.com>
Cc: Jim Cromie <jim.cromie@gmail.com>
Diffstat (limited to 'tools/lib/python/kdoc/parse_data_structs.py')
0 files changed, 0 insertions, 0 deletions
