[PATCH] cmd: Flush destination buffer only if it is available
Tom Rini
trini at konsulko.com
Tue May 20 15:57:05 CEST 2025
On Tue, May 20, 2025 at 02:35:53PM +0530, Varadarajan Narayanan wrote:
> On Mon, May 19, 2025 at 08:19:05AM -0600, Tom Rini wrote:
> > On Mon, May 19, 2025 at 12:19:34PM +0530, Varadarajan Narayanan wrote:
> >
> > > From: Vandhiadevan Karunamoorthy <quic_vkarunam at quicinc.com>
> > >
> > > There are code paths in do_imgextract(), where 'dest' could be zero.
> > > Hence, avoid cache flush of 'dest' doesn't point to any data buffer.
> > >
> > > Signed-off-by: Vandhiadevan Karunamoorthy <quic_vkarunam at quicinc.com>
> > > Signed-off-by: Varadarajan Narayanan <quic_varada at quicinc.com>
> > > ---
> > > cmd/ximg.c | 3 ++-
> > > 1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/cmd/ximg.c b/cmd/ximg.c
> > > index 29d7c3279b3..8907b579d4c 100644
> > > --- a/cmd/ximg.c
> > > +++ b/cmd/ximg.c
> > > @@ -265,7 +265,8 @@ do_imgextract(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
> > > puts("OK\n");
> > > }
> > >
> > > - flush_cache(dest, ALIGN(len, ARCH_DMA_MINALIGN));
> > > + if (dest)
> > > + flush_cache(dest, ALIGN(len, ARCH_DMA_MINALIGN));
> > >
> > > env_set_hex("fileaddr", data);
> > > env_set_hex("filesize", len);
> > >
> > > base-commit: 1b5e435102aa29a665119430196cb366ce36a01b
> >
> > A memory base of 0x0 is valid and not that uncommon, is there more going
> > on here that lead to this patch?
>
> Facing an abort if it 0x0 (arm64 based SoC).
OK, and is that valid memory? Or did you end up will a null pointer
somewhere? Other arm64 platforms, such as a Raspberry Pi, have valid
memory at 0x0 and so if we had used that address with this command would
need to flush the cache.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20250520/9b2f3de4/attachment.sig>
More information about the U-Boot
mailing list