[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <39518719.144820.1716586062550.JavaMail.zimbra@nod.at>
Date: Fri, 24 May 2024 23:27:42 +0200 (CEST)
From: Richard Weinberger <richard@....at>
To: Jarkko Sakkinen <jarkko@...nel.org>
Cc: kernel test robot <lkp@...el.com>, david <david@...ma-star.at>,
oe-kbuild-all <oe-kbuild-all@...ts.linux.dev>,
linux-kernel <linux-kernel@...r.kernel.org>,
david oberhollenzer <david.oberhollenzer@...ma-star.at>
Subject: Re: security/keys/trusted-keys/trusted_dcp.c:206:24: sparse:
sparse: incorrect type in assignment (different base types)
----- Ursprüngliche Mail -----
> Von: "Jarkko Sakkinen" <jarkko@...nel.org>
> An: "richard" <richard@....at>, "kernel test robot" <lkp@...el.com>
> CC: "david" <david@...ma-star.at>, "oe-kbuild-all" <oe-kbuild-all@...ts.linux.dev>, "linux-kernel"
> <linux-kernel@...r.kernel.org>, "david oberhollenzer" <david.oberhollenzer@...ma-star.at>
> Gesendet: Freitag, 24. Mai 2024 23:24:30
> Betreff: Re: security/keys/trusted-keys/trusted_dcp.c:206:24: sparse: sparse: incorrect type in assignment (different
> base types)
> On Sat May 25, 2024 at 12:06 AM EEST, Richard Weinberger wrote:
>> >| Reported-by: kernel test robot <lkp@...el.com>
>> >| Closes:
>> >| https://lore.kernel.org/oe-kbuild-all/202405240610.fj53EK0q-lkp@intelcom/
>> >
>> > 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:
Sure. Let me first talk to David and give it a test...
Thanks,
//richard
Powered by blists - more mailing lists