[PATCH] efi_loader: avoid superfluous variable store writes on unchanged data

Ilias Apalodimas ilias.apalodimas at linaro.org
Fri Mar 13 11:48:08 CET 2026


On Fri, 13 Mar 2026 at 12:42, Michal Simek <michal.simek at amd.com> wrote:
>
>
>
> On 3/13/26 11:28, Ilias Apalodimas wrote:
> > Thanks Michal
> >
> >
> > The code looks sane apart from the runtime part.
> >
> > [...]
> >
> >> +
> >> +                       if (!memcmp(old_data, data1, size1)) {
> >
> > So this will probably blowup in Linux. We had similar issues with
> > memcpy and added efi_memcpy_runtime()
>
> ok. It means you want to just do comparison via loop right?

yea. Don't think we have a fucntion for it already. You might as well
add something like

int __efi_runtime efi_runtime_memcmp(const void *s1, const void *s2, size_t n)
{
         const u8 *pos1 = s1;
         const u8 *pos2 = s2;

          for (; n; --n) {
                  if (*pos1 != *pos2)
                          return *pos1 - *pos2;
                  ++pos1;
                  ++pos2;
          }
          return 0;
  }

Cheers
/Ilias
>
> M


More information about the U-Boot mailing list