From: Dan Carpenter <error27@gmail.com>
To: gjoyce@linux.vnet.ibm.com
Cc: linux-block@vger.kernel.org, axboe@kernel.dk,
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, akpm@linux-foundation.org,
ndesaulniers@google.com, nathan@kernel.org, jarkko@kernel.org,
okozina@redhat.com
Subject: Re: [PATCH v8 3/3] powerpc/pseries: PLPKS SED Opal keystore support
Date: Wed, 20 May 2026 13:24:18 +0300 [thread overview]
Message-ID: <ag2L0kO_zK5hzx-W@stanley.mountain> (raw)
In-Reply-To: <20231004201957.1451669-4-gjoyce@linux.vnet.ibm.com>
On Wed, Oct 04, 2023 at 03:19:57PM -0500, gjoyce@linux.vnet.ibm.com wrote:
> +int sed_read_key(char *keyname, char *key, u_int *keylen)
> +{
> + struct plpks_var var;
> + struct plpks_sed_object_data data;
> + int ret;
> + u_int len;
> +
> + plpks_init_var(&var, keyname);
> +
> + if (!plpks_sed_available)
> + return -EOPNOTSUPP;
> +
> + var.data = (u8 *)&data;
> + var.datalen = sizeof(data);
> +
> + ret = plpks_read_os_var(&var);
> + if (ret != 0)
> + return ret;
> +
> + len = min_t(u16, be32_to_cpu(data.key_len), var.datalen);
^^^^^^^^^^^
This isn't the correct limit. This is the number of bytes that we
copied into data. Probably it's sizeof(data) and, hopefully, it's
at least the offsetof(struct plpks_sed_object_data, key).
To me the temptation is the initialize data to zero and
s/var.datalen/sizeof(data.key)/.
> + memcpy(key, data.key, len);
^^^^^^^^
> + key[len] = '\0';
> + *keylen = len;
> +
> + return 0;
> +}
regards,
dan carpenter
next prev parent reply other threads:[~2026-05-20 10:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-04 20:19 [PATCH v8 0/3] generic and PowerPC SED Opal keystore gjoyce
2023-10-04 20:19 ` [PATCH v8 1/3] block:sed-opal: " gjoyce
2023-10-04 20:19 ` [PATCH v8 2/3] block: sed-opal: keystore access for SED Opal keys gjoyce
2023-10-04 20:19 ` [PATCH v8 3/3] powerpc/pseries: PLPKS SED Opal keystore support gjoyce
2026-05-20 10:24 ` Dan Carpenter [this message]
2023-10-17 15:09 ` [PATCH v8 0/3] generic and PowerPC SED Opal keystore Greg Joyce
2023-10-17 15:24 ` Jens Axboe
2023-10-17 15:24 ` Jens Axboe
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=ag2L0kO_zK5hzx-W@stanley.mountain \
--to=error27@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=brking@linux.vnet.ibm.com \
--cc=gjoyce@linux.vnet.ibm.com \
--cc=jarkko@kernel.org \
--cc=jonathan.derrick@linux.dev \
--cc=linux-block@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=msuchanek@suse.de \
--cc=nathan@kernel.org \
--cc=nayna@linux.ibm.com \
--cc=ndesaulniers@google.com \
--cc=okozina@redhat.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