The size value is not needed for the free function because it uses free() instead of kfree()
As far as I know, you can't use kfree() in user space. On Sun, Nov 22, 2026 at 2:38 PM Ahmed Khider <[email protected]> wrote: > --- > boot/boot_script.c | 29 ++++++++++++++--------------- > 1 file changed, 14 insertions(+), 15 deletions(-) > > diff --git a/boot/boot_script.c b/boot/boot_script.c > index 2646ae3b..5f96c903 100644 > --- a/boot/boot_script.c > +++ b/boot/boot_script.c > @@ -113,13 +113,12 @@ free_cmd (struct cmd *cmd, int aborting) > { > int i; > for (i = 0; i < cmd->args_index; i++) > - boot_script_free (cmd->args[i], sizeof *cmd->args[i]); > - boot_script_free (cmd->args, sizeof cmd->args[0] * cmd->args_alloc); > + boot_script_free (cmd->args[i]); > + boot_script_free (cmd->args); > } > if (cmd->exec_funcs) > - boot_script_free (cmd->exec_funcs, > - sizeof cmd->exec_funcs[0] * cmd->exec_funcs_alloc); > - boot_script_free (cmd, sizeof *cmd); > + boot_script_free (cmd->exec_funcs); > + boot_script_free (cmd); > } > > /* Free all storage allocated by the parser. > @@ -131,13 +130,13 @@ cleanup (int aborting) > > for (i = 0; i < cmds_index; i++) > free_cmd (cmds[i], aborting); > - boot_script_free (cmds, sizeof cmds[0] * cmds_alloc); > + boot_script_free (cmds); > cmds = 0; > cmds_index = cmds_alloc = 0; > > for (i = 0; i < symtab_index; i++) > - boot_script_free (symtab[i], sizeof *symtab[i]); > - boot_script_free (symtab, sizeof symtab[0] * symtab_alloc); > + boot_script_free (symtab[i]); > + boot_script_free (symtab); > symtab = 0; > symtab_index = symtab_alloc = 0; > } > @@ -164,7 +163,7 @@ add_list (void *ptr, void ***ptr_list, int *alloc, int > *index, int incr) > if (*ptr_list) > { > memcpy (p, *ptr_list, *index * sizeof (void *)); > - boot_script_free (*ptr_list, (*alloc - incr) * sizeof (void *)); > + boot_script_free (*ptr_list); > } > *ptr_list = p; > } > @@ -189,7 +188,7 @@ add_arg (struct cmd *cmd, const char *text, int > textlen, int type, intptr_t val) > if (add_list (arg, (void ***) &cmd->args, > &cmd->args_alloc, &cmd->args_index, 5)) > { > - boot_script_free (arg, sizeof *arg); > + boot_script_free (arg); > return 0; > } > } > @@ -221,7 +220,7 @@ sym_enter (const char *name) > sym->name = name; > if (add_list (sym, (void ***) &symtab, &symtab_alloc, > &symtab_index, 20)) > { > - boot_script_free (sym, sizeof *sym); > + boot_script_free (sym); > return 0; > } > } > @@ -481,7 +480,7 @@ boot_script_parse_line (void *hook, char *cmdline) > memcpy (ptr, cmdline, cmdline_index); \ > for (i = 0; i < argc; ++i) \ > argv[i] = ptr + (argv[i] - cmdline); \ > - boot_script_free (cmdline, cmdline_alloc); \ > + boot_script_free (cmdline); \ > cmdline = ptr; \ > cmdline_alloc = alloc; \ > } \ > @@ -519,7 +518,7 @@ boot_script_exec (void) > argv = boot_script_malloc (sizeof (char *) * (cmd->args_index + 2)); > if (! argv) > { > - boot_script_free (cmdline, cmdline_alloc); > + boot_script_free (cmdline); > cleanup (1); > return BOOT_SCRIPT_NOMEM; > } > @@ -629,8 +628,8 @@ boot_script_exec (void) > error = 0; > > done: > - boot_script_free (cmdline, cmdline_alloc); > - boot_script_free (argv, sizeof (char *) * (cmd->args_index + 2)); > + boot_script_free (cmdline); > + boot_script_free (argv); > if (error) > { > cleanup (1); > -- > 2.47.3 > >
