[bug report] tracing/kprobes: Add symbol counting check when module loads
From: Dan Carpenter <hidden>
Date: 2024-07-18 18:31:00
Hello Masami Hiramatsu (Google),
Commit 9d8616034f16 ("tracing/kprobes: Add symbol counting check when
module loads") from Jul 5, 2024 (linux-next), leads to the following
Smatch static checker warning:
kernel/trace/trace_kprobe.c:828 validate_probe_symbol()
warn: missing error code here? 'try_module_get_by_name()' failed. 'ret' = '0'
kernel/trace/trace_kprobe.c
815 static int validate_probe_symbol(char *symbol)
816 {
817 struct module *mod = NULL;
818 char *modname = NULL, *p;
819 int ret = 0;
820
821 p = strchr(symbol, ':');
822 if (p) {
823 modname = symbol;
824 symbol = p + 1;
825 *p = '\0';
826 mod = try_module_get_by_name(modname);
827 if (!mod)
--> 828 goto out;
Is it intentional that "ret = 0;" here?
829 }
830
831 ret = validate_module_probe_symbol(modname, symbol);
832 out:
833 if (p)
834 *p = ':';
835 if (mod)
836 module_put(mod);
837 return ret;
838 }
regards,
dan carpenter