[PATCH] livepatch: Make error message explicitly for the overlength function name

From: Minfei Huang
Date: Tue Apr 14 2015 - 22:02:43 EST

For not, livepatch do not support the function which name is larger than
KSYM_NAME_LEN-1. It may be confusion user with error message
"livepatch: symbol 'xxx(function name)' not found in symbol table".

Make error message explicitly for overlength issue.

Signed-off-by: Minfei Huang <minfei.huang@xxxxxxxxxxx>
kernel/livepatch/core.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
index 3f9f1d6..d1f2404 100644
--- a/kernel/livepatch/core.c
+++ b/kernel/livepatch/core.c
@@ -789,6 +789,12 @@ static int klp_init_object(struct klp_patch *patch, struct klp_object *obj)
return -ENOMEM;

for (func = obj->funcs; func->old_name; func++) {
+ if (strlen(func->old_name) > (KSYM_NAME_LEN-1)) {
+ pr_err("%s is overlength, the max to be supported is %d\n",
+ func->old_name, KSYM_NAME_LEN-1);
+ ret = -EINVAL;
+ goto free;
+ }
ret = klp_init_func(obj, func);
if (ret)
goto free;

> Best Regards,
> Petr
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/