linux-efi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Joyce <gjoyce@linux.vnet.ibm.com>
To: "Elliott, Robert (Servers)" <elliott@hpe.com>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>
Cc: "linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	"jonathan.derrick@linux.dev" <jonathan.derrick@linux.dev>,
	"brking@linux.vnet.ibm.com" <brking@linux.vnet.ibm.com>,
	"msuchanek@suse.de" <msuchanek@suse.de>,
	"mpe@ellerman.id.au" <mpe@ellerman.id.au>,
	"nayna@linux.ibm.com" <nayna@linux.ibm.com>,
	"axboe@kernel.dk" <axboe@kernel.dk>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"linux-efi@vger.kernel.org" <linux-efi@vger.kernel.org>,
	"keyrings@vger.kernel.org" <keyrings@vger.kernel.org>,
	"dhowells@redhat.com" <dhowells@redhat.com>,
	"jarkko@kernel.org" <jarkko@kernel.org>
Subject: Re: [PATCH v4 2/3] powerpc/pseries: PLPKS SED Opal keystore support
Date: Wed, 16 Nov 2022 17:44:18 -0600	[thread overview]
Message-ID: <c24c0f7c81ff24d791974ff7945e710b489b7e01.camel@linux.vnet.ibm.com> (raw)
In-Reply-To: <MW5PR84MB1842689FD13382CAFCC260D8AB5F9@MW5PR84MB1842.NAMPRD84.PROD.OUTLOOK.COM>

On Fri, 2022-10-07 at 19:09 +0000, Elliott, Robert (Servers) wrote:
> > -----Original Message-----
> > From: gjoyce@linux.vnet.ibm.com <gjoyce@linux.vnet.ibm.com>
> > Sent: Friday, August 19, 2022 5:32 PM
> > To: linux-block@vger.kernel.org
> > Cc: linuxppc-dev@lists.ozlabs.org; jonathan.derrick@linux.dev;
> > brking@linux.vnet.ibm.com; msuchanek@suse.de; mpe@ellerman.id.au;
> > nayna@linux.ibm.com; axboe@kernel.dk; akpm@linux-foundation.org;
> > gjoyce@linux.vnet.ibm.com; linux-efi@vger.kernel.org;
> > keyrings@vger.kernel.org; dhowells@redhat.com; jarkko@kernel.org
> > Subject: [PATCH v4 2/3] powerpc/pseries: PLPKS SED Opal keystore
> > support
> > 
> > +++ b/arch/powerpc/platforms/pseries/plpks_sed_ops.c
> ...
> > +struct plpks_sed_object_data {
> > +	u_char version;
> > +	u_char pad1[7];
> > +	u_long authority;
> > +	u_long range;
> > +	u_int  key_len;
> > +	u_char key[32];
> > +};
> ...
> > +/*
> > + * Read the SED Opal key from PLPKS given the label
> > + */
> > +int sed_read_key(char *keyname, char *key, u_int *keylen)
> > +{
> ...
> > +	*keylen = be32_to_cpu(data->key_len);
> > +
> > +	if (var.data) {
> > +		memcpy(key, var.data + offset, var.datalen - offset);
> > +		key[*keylen] = '\0';
> 
> Is there a guarantee that key_len is always < sizeof key, or
> does that need to be checked in more places?

Changed keylen paramter to be the maximum size that it copied. This 
will help avoid buffer overwrite.



  reply	other threads:[~2022-11-16 23:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-19 22:31 [PATCH v4 0/3] generic and PowerPC SED Opal keystore gjoyce
2022-08-19 22:31 ` [PATCH v4 1/3] block: sed-opal: " gjoyce
2022-10-07 18:23   ` Jonathan Derrick
2022-08-19 22:31 ` [PATCH v4 2/3] powerpc/pseries: PLPKS SED Opal keystore support gjoyce
2022-10-07 18:22   ` Jonathan Derrick
2022-10-07 19:09   ` Elliott, Robert (Servers)
2022-11-16 23:44     ` Greg Joyce [this message]
2022-08-19 22:31 ` [PATCH v4 3/3] block: sed-opal: keystore access for SED Opal keys gjoyce
2022-10-07 18:21   ` Jonathan Derrick
2022-11-16 23:16     ` Greg Joyce

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c24c0f7c81ff24d791974ff7945e710b489b7e01.camel@linux.vnet.ibm.com \
    --to=gjoyce@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=brking@linux.vnet.ibm.com \
    --cc=dhowells@redhat.com \
    --cc=elliott@hpe.com \
    --cc=jarkko@kernel.org \
    --cc=jonathan.derrick@linux.dev \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=msuchanek@suse.de \
    --cc=nayna@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).