On Fri, Mar 23, 2018 at 01:00:23PM +0100, Petr Mladek wrote:
> @@ -687,7 +858,14 @@ static void klp_free_patch(struct klp_patch *patch)
>  
>  static int klp_init_func(struct klp_object *obj, struct klp_func *func)
>  {
> -     if (!func->old_name || !func->new_func)
> +     if (!func->old_name)
> +             return -EINVAL;
> +
> +     /*
> +      * NOPs get the address later. The the patched module must be loaded,

"The the" -> "the"

> +      * see klp_init_object_loaded().
> +      */
> +     if (!func->new_func && !func->nop)
>               return -EINVAL;

>  
>       INIT_LIST_HEAD(&func->stack_node);
> @@ -742,6 +920,9 @@ static int klp_init_object_loaded(struct klp_patch *patch,
>                       return -ENOENT;
>               }
>  
> +             if (func->nop)
> +                     func->new_func = (void *)func->old_addr;
> +

These changes make it more obvious that 'new_func' isn't quite the right
name.  It should really be 'new_addr' IMO.

-- 
Josh

Reply via email to