[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c706add87f230c12d41dc5f74789ed18f43fa9d5.camel@linux.ibm.com>
Date: Mon, 13 Feb 2023 18:07:10 +1100
From: Andrew Donnellan <ajd@...ux.ibm.com>
To: Michael Ellerman <michaele@....ibm.com>,
Stefan Berger <stefanb@...ux.ibm.com>,
linuxppc-dev@...ts.ozlabs.org, linux-integrity@...r.kernel.org
Cc: sudhakar@...ux.ibm.com, erichte@...ux.ibm.com,
gregkh@...uxfoundation.org, nayna@...ux.ibm.com, npiggin@...il.com,
linux-kernel@...r.kernel.org, zohar@...ux.ibm.com,
gjoyce@...ux.ibm.com, ruscur@...sell.cc, joel@....id.au,
bgray@...ux.ibm.com, brking@...ux.ibm.com, gcwilson@...ux.ibm.com
Subject: Re: [PATCH v6 24/26] powerpc/pseries: Implement secvars for dynamic
secure boot
On Mon, 2023-02-13 at 16:26 +1100, Michael Ellerman wrote:
> Andrew Donnellan <ajd@...ux.ibm.com> writes:
> > On Fri, 2023-02-10 at 16:28 -0500, Stefan Berger wrote:
> > > > > +err:
> > > > > + kfree(var.data);
> > > >
> > > > remove the kfree()
> > >
> > > Actually don't remove it but it should probably be
> > >
> > > if (var.data != &version)
> > > kfree(var.data);
> > >
> >
> > Argh, thanks for catching this.
> >
> > I don't think the condition is needed - we can assume the var.data
> > is
> > unmodified.
> >
> > mpe, are you able to fix this up in merge?
>
> Yeah, can you reply here with the delta you want applied.
>
> cheers
diff --git a/arch/powerpc/platforms/pseries/plpks-secvar.c
b/arch/powerpc/platforms/pseries/plpks-secvar.c
index 98d0f2b31e0d..bdfe63bc8705 100644
--- a/arch/powerpc/platforms/pseries/plpks-secvar.c
+++ b/arch/powerpc/platforms/pseries/plpks-secvar.c
@@ -135,7 +135,7 @@ static int plpks_set_variable(const char *key, u64
key_len, u8 *data,
goto err;
var.namelen = rc * 2;
- memcpy(&flags, data, sizeof(flags));
+ flags = cpu_to_be64p((__u64 *)data);
var.datalen = data_size - sizeof(flags);
var.data = data + sizeof(flags);
@@ -184,7 +184,6 @@ static ssize_t plpks_secvar_format(char *buf,
size_t bufsize)
ret = snprintf(buf, bufsize, "ibm,plpks-sb-v%hhu", version);
err:
- kfree(var.data);
return ret;
}
--
Andrew Donnellan OzLabs, ADL Canberra
ajd@...ux.ibm.com IBM Australia Limited
Powered by blists - more mailing lists