[PATCH 6/6] ftrace: break out modify loop immediately on detection of error

Steven Rostedt
2009-02-20T01:17:34Z

[-- Attachment #1: 0006-ftrace-break-out-modify-loop-immediately-on-detecti.patch --]
[-- Type: text/plain, Size: 882 bytes --]

From: Steven Rostedt <srostedt@redhat.com>

Impact: added precaution on failure detection

Break out of the modifying loop as soon as a failure is detected.
This is just an added precaution found by code review and was not
found by any bug chasing.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
kernel/trace/ftrace.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index de3bd93..f9fe29d 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -557,10 +557,14 @@ static void ftrace_replace_code(int enable)
if ((system_state == SYSTEM_BOOTING) ||
!core_kernel_text(rec->ip)) {
ftrace_free_rec(rec);
- } else
+ } else {
ftrace_bug(failed, rec->ip);
+ goto out;
+ }
}
} while_for_each_ftrace_rec();
+ out:
+ return;
}

static int
--
1.5.6.5

--