]> git.baikalelectronics.ru Git - kernel.git/commit
tracing: Make -ENOMEM the default error for parse_synth_field()
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Mon, 2 Nov 2020 16:28:39 +0000 (11:28 -0500)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Mon, 2 Nov 2020 20:58:32 +0000 (15:58 -0500)
commit20e1fa6cc65cedcc5ca2fcdf358243b90f3c47c0
treef8bb7cf306ea1514a1609212ee16061ee0bb27cd
parentd98a92e2b99d12a64f61b5e0bd35d420c12159db
tracing: Make -ENOMEM the default error for parse_synth_field()

parse_synth_field() returns a pointer and requires that errors get
surrounded by ERR_PTR(). The ret variable is initialized to zero, but should
never be used as zero, and if it is, it could cause a false return code and
produce a NULL pointer dereference. It makes no sense to set ret to zero.

Set ret to -ENOMEM (the most common error case), and have any other errors
set it to something else. This removes the need to initialize ret on *every*
error branch.

Fixes: e029058038e9 ("tracing, synthetic events: Replace buggy strcat() with seq_buf operations")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
kernel/trace/trace_events_synth.c