[PATCH v3 2/5] misc: fs_loader: allow using long script name in request_firmware_into_buf_via_script()
Lothar Waßmann
LW at KARO-electronics.de
Thu Sep 4 11:28:11 CEST 2025
Hi,
On Thu, 4 Sep 2025 08:23:28 +0800 Weijie Gao wrote:
> On Wed, 2025-09-03 at 13:36 +0200, Lothar Waßmann wrote:
> > External email : Please do not click links or open attachments until
> > you have verified the sender or the content.
> >
> >
> > Hi,
> >
> > On Wed, 3 Sep 2025 16:38:30 +0800 Weijie Gao wrote:
> > > Use cmd_process() to remove the length limit of script name used
> > > for
> > > run_command().
> > >
> > > Signed-off-by: Weijie Gao <weijie.gao at mediatek.com>
> > > ---
> > > drivers/misc/fs_loader.c | 9 +++------
> > > 1 file changed, 3 insertions(+), 6 deletions(-)
> > >
> > > diff --git a/drivers/misc/fs_loader.c b/drivers/misc/fs_loader.c
> > > index 87acd385e23..6a6796c1931 100644
> > > --- a/drivers/misc/fs_loader.c
> > > +++ b/drivers/misc/fs_loader.c
> > > @@ -232,18 +232,15 @@ int request_firmware_into_buf_via_script(void
> > > **buf, size_t max_size,
> > > const char *script_name,
> > > size_t *retsize)
> > > {
> > > + char *args[2] = { (char *)"run", (char *)script_name };
> > >
> >
> > const char *args[2] = { "run", script_name };
> > does not work?
> >
> > I don't see any need for a non-const 'args' here.
>
> We'll get compiler warning if using const char *[]:
>
> CC drivers/misc/fs_loader.o
> drivers/misc/fs_loader.c: In function
> 'request_firmware_into_buf_via_script':
> drivers/misc/fs_loader.c:243:33: warning: passing argument 3 of
> 'cmd_process' from incompatible pointer type [-Wincompatible-pointer-
> types]
> 243 | ret = cmd_process(0, 2, args, &repeatable, NULL);
> | ^~~~
> | |
> | const char **
>
OK. But at least:
char *args[2] = { "run", (char *)script_name };
should work...
NB: The right fix would be to change the argument type of cmd_process()
(and all functions with similar semantics...) to
"const char *const argv[]", since cmd_process() need not and should not
be able to modify any of the strings within argv[].
Lothar Waßmann
More information about the U-Boot
mailing list