On Thu, Oct 17, 2024 at 03:14:46AM +0000, Peng Fan wrote:
> > Subject: Re: [PATCH] cpu: imx8_cpu: Avoid revision to corrupt device
> > tree
> > 
> > On Fri, Oct 11, 2024 at 06:58:27PM +0800, Peng Fan (OSS) wrote:
> > 
> > > From: Peng Fan <peng....@nxp.com>
> > >
> > > U-Boot device tree is padded just after U-Boot proper. After the
> > whole
> > > stuff loaded to DRAM space, the device tree area is conflict with BSS
> > > region before U-Boot relocation. So any write to BSS area before
> > > reloc_fdt will corrupt the device tree. Without the fix, there is
> > > issue that “binman_init failed:-2” on i.MX8MP-EVK board.
> > >
> > > Move the variable to data section to fix the issue
> > >
> > > Signed-off-by: Peng Fan <peng....@nxp.com>
> > > ---
> > >  drivers/cpu/imx8_cpu.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/cpu/imx8_cpu.c b/drivers/cpu/imx8_cpu.c index
> > > 6c0a8c0cbe4..19c65c7ce47 100644
> > > --- a/drivers/cpu/imx8_cpu.c
> > > +++ b/drivers/cpu/imx8_cpu.c
> > > @@ -71,7 +71,7 @@ static const char *get_imx_type_str(u32
> > imxtype)
> > >
> > >  static const char *get_imx_rev_str(u32 rev)  {
> > > - static char revision[4];
> > > + static char revision[4] __section(".data");
> > 
> > After my last mail, I pulled up the patch itself and started looking at the
> > driver. Why is "revision" being done like this? This is not a good
> > common practice.
> 
> Since the function returns a pointer to a string, so ...
> We could move it to malloc area.

Yes, something like that sounds better, thanks.

-- 
Tom

Attachment: signature.asc
Description: PGP signature

Reply via email to