This method is used to be able to decide whether a function name matched the "do_" ... "_op" structure of some Xen hypercalls. Signed-off-by: Norbert Manthey <nmanthey@xxxxxxxxx> --- check_user_data2.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/check_user_data2.c b/check_user_data2.c index 7c11b58..2455e62 100644 --- a/check_user_data2.c +++ b/check_user_data2.c @@ -962,6 +962,22 @@ static void set_called(const char *name, struct symbol *sym, char *key, char *va set_state(my_call_id, "this_function", NULL, &called); } +static int ends_with(const char *symbol, const char *suffix) +{ + int l = strnlen(symbol, 128); + int e = strnlen(suffix, 16); + + // is the string smaller than the suffix? + if(l < e) return 0; + + // check from the end whether the strings match + for(int i = 0; i <= e; ++ i) + if( symbol[l-i] != suffix[e-i]) return 0; + + // the suffix matches + return 1; +} + static void match_syscall_definition(struct symbol *sym) { struct symbol *arg; -- 2.7.4 Amazon Development Center Germany GmbH Berlin - Dresden - Aachen main office: Krausenstr. 38, 10117 Berlin Geschaeftsfuehrer: Dr. Ralf Herbrich, Christian Schlaeger Ust-ID: DE289237879 Eingetragen am Amtsgericht Charlottenburg HRB 149173 B