Il giorno mar 27 ott 2026 alle ore 15:36 Simon Glass
<[email protected]> ha scritto:
>
> Hi Christian,
>
> On 2026-10-27T12:38:55, Christian Marangi <[email protected]> wrote:
> > misc: fs_loader: validate requested offset on reading file
> >
> > Make sure we are not requesting an offset for the requesting file beyond
> > the size of the file.
> >
> > If it's such the case, log an error and return -EINVAL.
> >
> > Code is reworked and split in various subfunction to permit re-preparing
> > the filesystem after a fs_close (called by fs_size) and reduce patch delta
> > of upcoming support for reading ONLY the size of the requested firmware.
> >
> > Dedicated mount function are created to mount relevant filesystem only once
> > and follow the same if-else logic pattern used by the prepare functions.
> >
> > Signed-off-by: Christian Marangi <[email protected]>
> >
> >  drivers/misc/fw_loader/fs_loader.c | 97 
> > ++++++++++++++++++++++++++++++--------
> >  1 file changed, 77 insertions(+), 20 deletions(-)
>
> > diff --git a/drivers/misc/fw_loader/fs_loader.c 
> > b/drivers/misc/fw_loader/fs_loader.c
> > @@ -113,6 +123,55 @@ static int fw_get_filesystem_firmware(struct udevice 
> > *dev)
> > +     if (upriv->offset > size) {
> > +             log_err("Invalid offset. Entry too small\n");
>
> Ideally you would include the offset and the file size, and say 'file'
> rather than 'entry', e.g.:
>
>     log_err("Offset %#x beyond file size %#llx\n", upriv->offset, size);
>
> In any case:
>
> Reviewed-by: Simon Glass <[email protected]>
>

Yes sorry I forgot to update it.

Reply via email to