Re: [PATCH 2/3] restart: give all restart handlers a descriptive name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 02, 2020 at 09:57:56AM +0200, Ahmad Fatoum wrote:
> diff --git a/common/restart.c b/common/restart.c
> index dd15c8d5c362..66131c262938 100644
> --- a/common/restart.c
> +++ b/common/restart.c
> @@ -47,6 +47,7 @@ int restart_handler_register(struct restart_handler *rst)
>  
>  /**
>   * restart_handler_register_fn() - register a handler function
> + * @name:	restart method name or NULL if name should be auto-generated
>   * @restart_fn:	The restart function
>   *
>   * convenience wrapper for restart_handler_register() to register a handler
> @@ -54,13 +55,15 @@ int restart_handler_register(struct restart_handler *rst)
>   *
>   * return: 0 for success or negative error code
>   */
> -int restart_handler_register_fn(void (*restart_fn)(struct restart_handler *))
> +int restart_handler_register_fn(const char *name,
> +				void (*restart_fn)(struct restart_handler *))
>  {
>  	struct restart_handler *rst;
>  	int ret;
>  
>  	rst = xzalloc(sizeof(*rst));
>  
> +	rst->name = name;

Please allocate the name in case someone passes an array from the stack
here.

Regards,
  Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux