summaryrefslogtreecommitdiffstats
path: root/lib/fault-inject.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/fault-inject.c')
-rw-r--r--lib/fault-inject.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/lib/fault-inject.c b/lib/fault-inject.c
index cf7b129b0b2b..e26aa4f65eb9 100644
--- a/lib/fault-inject.c
+++ b/lib/fault-inject.c
@@ -65,22 +65,16 @@ static bool fail_task(struct fault_attr *attr, struct task_struct *task)
65 65
66static bool fail_stacktrace(struct fault_attr *attr) 66static bool fail_stacktrace(struct fault_attr *attr)
67{ 67{
68 struct stack_trace trace;
69 int depth = attr->stacktrace_depth; 68 int depth = attr->stacktrace_depth;
70 unsigned long entries[MAX_STACK_TRACE_DEPTH]; 69 unsigned long entries[MAX_STACK_TRACE_DEPTH];
71 int n; 70 int n, nr_entries;
72 bool found = (attr->require_start == 0 && attr->require_end == ULONG_MAX); 71 bool found = (attr->require_start == 0 && attr->require_end == ULONG_MAX);
73 72
74 if (depth == 0) 73 if (depth == 0)
75 return found; 74 return found;
76 75
77 trace.nr_entries = 0; 76 nr_entries = stack_trace_save(entries, depth, 1);
78 trace.entries = entries; 77 for (n = 0; n < nr_entries; n++) {
79 trace.max_entries = depth;
80 trace.skip = 1;
81
82 save_stack_trace(&trace);
83 for (n = 0; n < trace.nr_entries; n++) {
84 if (attr->reject_start <= entries[n] && 78 if (attr->reject_start <= entries[n] &&
85 entries[n] < attr->reject_end) 79 entries[n] < attr->reject_end)
86 return false; 80 return false;