From: "Jarkko Sakkinen" <jarkko@kernel.org>
To: "Richard Weinberger" <richard@nod.at>,
"kernel test robot" <lkp@intel.com>
Cc: "david" <david@sigma-star.at>,
"oe-kbuild-all" <oe-kbuild-all@lists.linux.dev>,
"linux-kernel" <linux-kernel@vger.kernel.org>,
"david oberhollenzer" <david.oberhollenzer@sigma-star.at>
Subject: Re: security/keys/trusted-keys/trusted_dcp.c:206:24: sparse: sparse: incorrect type in assignment (different base types)
Date: Sat, 25 May 2024 00:24:30 +0300 [thread overview]
Message-ID: <D1I6WMDSLOW0.2RS18E7T61X9A@kernel.org> (raw)
In-Reply-To: <1855855000.144805.1716584815663.JavaMail.zimbra@nod.at>
On Sat May 25, 2024 at 12:06 AM EEST, Richard Weinberger wrote:
> >| Reported-by: kernel test robot <lkp@intel.com>
> >| Closes:
> >| https://lore.kernel.org/oe-kbuild-all/202405240610.fj53EK0q-lkp@intel.com/
> >
> > sparse warnings: (new ones prefixed by >>)
> >>> security/keys/trusted-keys/trusted_dcp.c:206:24: sparse: sparse: incorrect type
> >>> in assignment (different base types) @@ expected restricted __le32
> >>> [usertype] payload_len @@ got unsigned int @@
> > security/keys/trusted-keys/trusted_dcp.c:206:24: sparse: expected restricted
> > __le32 [usertype] payload_len
> > security/keys/trusted-keys/trusted_dcp.c:206:24: sparse: got unsigned int
> >
> > vim +206 security/keys/trusted-keys/trusted_dcp.c
> >
> > 179
> > 180 static int trusted_dcp_seal(struct trusted_key_payload *p, char *datablob)
> > 181 {
> > 182 struct dcp_blob_fmt *b = (struct dcp_blob_fmt *)p->blob;
> > 183 int blen, ret;
> > 184
> > 185 blen = calc_blob_len(p->key_len);
> > 186 if (blen > MAX_BLOB_SIZE)
> > 187 return -E2BIG;
> > 188
> > 189 b->fmt_version = DCP_BLOB_VERSION;
> > 190 get_random_bytes(b->nonce, AES_KEYSIZE_128);
> > 191 get_random_bytes(b->blob_key, AES_KEYSIZE_128);
> > 192
> > 193 ret = do_aead_crypto(p->key, b->payload, p->key_len, b->blob_key,
> > 194 b->nonce, true);
> > 195 if (ret) {
> > 196 pr_err("Unable to encrypt blob payload: %i\n", ret);
> > 197 return ret;
> > 198 }
> > 199
> > 200 ret = encrypt_blob_key(b->blob_key);
> > 201 if (ret) {
> > 202 pr_err("Unable to encrypt blob key: %i\n", ret);
> > 203 return ret;
> > 204 }
> > 205
> > > 206 b->payload_len = get_unaligned_le32(&p->key_len);
>
> I think this should be a put_unaligned_le32(p->key_len, &b->payload_len).
Please send then fix, reasoning of that, and finally:
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202405240610.fj53EK0q-lkp@intel.com/
> Thanks,
> //richard
BR, Jarkko
next prev parent reply other threads:[~2024-05-24 21:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-23 22:48 security/keys/trusted-keys/trusted_dcp.c:206:24: sparse: sparse: incorrect type in assignment (different base types) kernel test robot
2024-05-24 21:06 ` Richard Weinberger
2024-05-24 21:24 ` Jarkko Sakkinen [this message]
2024-05-24 21:27 ` Richard Weinberger
2024-05-24 22:21 ` Jarkko Sakkinen
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=D1I6WMDSLOW0.2RS18E7T61X9A@kernel.org \
--to=jarkko@kernel.org \
--cc=david.oberhollenzer@sigma-star.at \
--cc=david@sigma-star.at \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=richard@nod.at \
/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