[PATCH v1] misc: fs_loader: Initialize actread variable

Yuslaimi, Alif Zakuan alif.zakuan.yuslaimi at altera.com
Mon Aug 18 04:28:36 CEST 2025


Hi,

> -----Original Message-----
> From: Tom Rini <trini at konsulko.com>
> Sent: Saturday, August 16, 2025 3:11 AM
> To: Marek Vasut <marek.vasut at mailbox.org>
> Cc: Yuslaimi, Alif Zakuan <alif.zakuan.yuslaimi at altera.com>; u-
> boot at lists.denx.de; Chee, Tien Fong <tien.fong.chee at altera.com>; Marek
> Vasut <marex at denx.de>; Simon Goldschmidt
> <simon.k.r.goldschmidt at gmail.com>
> Subject: Re: [PATCH v1] misc: fs_loader: Initialize actread variable
> 
> On Fri, Aug 15, 2025 at 09:07:17PM +0200, Marek Vasut wrote:
> > On 8/15/25 8:58 PM, Tom Rini wrote:
> > > On Mon, Aug 04, 2025 at 07:46:30PM -0700,
> alif.zakuan.yuslaimi at altera.com wrote:
> > >
> > > > From: Alif Zakuan Yuslaimi <alif.zakuan.yuslaimi at altera.com>
> > > >
> > > > Initialize the actread variable to prevent undefined behavior that
> > > > can occur if the variable is used before being assigned a value.
> > > >
> > > > This will help to prevent potential issues, especially if actread
> > > > is used (e.g., read, incremented, or returned) before being
> > > > explicitly set elsewhere in the code.
> > > >
> > > > Signed-off-by: Alif Zakuan Yuslaimi
> > > > <alif.zakuan.yuslaimi at altera.com>
> > > > ---
> > > >   drivers/misc/fs_loader.c | 3 ++-
> > > >   1 file changed, 2 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/misc/fs_loader.c b/drivers/misc/fs_loader.c
> > > > index 66803f4b997..cc07bfa7f14 100644
> > > > --- a/drivers/misc/fs_loader.c
> > > > +++ b/drivers/misc/fs_loader.c
> > > > @@ -1,6 +1,7 @@
> > > >   // SPDX-License-Identifier: GPL-2.0
> > > >    /*
> > > >    * Copyright (C) 2018-2019 Intel Corporation <www.intel.com>
> > > > + * Copyright (C) 2025 Altera Corporation <www.altera.com>
> > > >    *
> > > >    */
> > > > @@ -148,7 +149,7 @@ static int _request_firmware_prepare(struct
> udevice *dev,
> > > >    */
> > > >   static int fw_get_filesystem_firmware(struct udevice *dev)
> > > >   {
> > > > -	loff_t actread;
> > > > +	loff_t actread = 0;
> > > >   	char *storage_interface, *dev_part, *ubi_mtdpart, *ubi_volume;
> > > >   	int ret;
> > >
> > > A one line "initialize a variable" is not sufficient for adding a
> > > Copyright line, please drop in v2, thanks.
> > Technically they already have a copyright line there, they only
> > updated the year. This was probably written when altera was intel PSG,
> > now altera is altera again, so there are two copyright lines, but it
> > is the same group of people.
> 
> It's been a while since I waded in to discussion about copyright lines in code,
> but I seem to recall that a one line change of this nature is also not enough
> for extending a year on an existing claim. Something about substantial work
> needing to be done.
> 
> --
> Tom

Thanks for the comments, I will drop the copyright line in v2.


More information about the U-Boot mailing list