kobject_init_and_add() takes expects format string for a name, so we better provide it in order to avoid infoleaks if modules craft their mod->name in a special way.
Unified · Split
| @@ -731,7 +731,7 @@ static int klp_init_func(struct klp_object *obj, struct klp_func *func) · 730 unmodified lines | ||
| 731 | 731 | func->state = KLP_DISABLED; |
| 732 | 732 | |
| 733 | 733 | return kobject_init_and_add(&func->kobj, &klp_ktype_func, |
| 734 | − obj->kobj, func->old_name); | |
| 734 | + obj->kobj, "%s", func->old_name); | |
| 735 | 735 | } |
| 736 | 736 | |
| 737 | 737 | /* parts of the initialization that is done only when the object is loaded */ |
| @@ -807,7 +807,7 @@ static int klp_init_patch(struct klp_patch *patch) · 69 unmodified lines | ||
| 807 | 807 | patch->state = KLP_DISABLED; |
| 808 | 808 | |
| 809 | 809 | ret = kobject_init_and_add(&patch->kobj, &klp_ktype_patch, |
| 810 | − klp_root_kobj, patch->mod->name); | |
| 810 | + klp_root_kobj, "%s", patch->mod->name); | |
| 811 | 811 | if (ret) |
| 812 | 812 | goto unlock; |
| 813 | 813 | |