* security/keys/trusted-keys/trusted_dcp.c:206:24: sparse: sparse: incorrect type in assignment (different base types)
@ 2024-05-23 22:48 kernel test robot
2024-05-24 21:06 ` Richard Weinberger
0 siblings, 1 reply; 5+ messages in thread
From: kernel test robot @ 2024-05-23 22:48 UTC (permalink / raw)
To: David Gstir
Cc: oe-kbuild-all, linux-kernel, Jarkko Sakkinen, Richard Weinberger,
David Oberhollenzer
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 6d69b6c12fce479fde7bc06f686212451688a102
commit: 2e8a0f40a39cc253002f21c54e1b5b995e5ec510 KEYS: trusted: Introduce NXP DCP-backed trusted keys
date: 2 weeks ago
config: arm-randconfig-r112-20240524 (https://download.01.org/0day-ci/archive/20240524/202405240610.fj53EK0q-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20240524/202405240610.fj53EK0q-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| 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);
207 p->blob_len = blen;
208 return 0;
209 }
210
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: security/keys/trusted-keys/trusted_dcp.c:206:24: sparse: sparse: incorrect type in assignment (different base types)
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
0 siblings, 1 reply; 5+ messages in thread
From: Richard Weinberger @ 2024-05-24 21:06 UTC (permalink / raw)
To: kernel test robot
Cc: david, oe-kbuild-all, linux-kernel, Jarkko Sakkinen,
david oberhollenzer
----- Ursprüngliche Mail -----
> Von: "kernel test robot" <lkp@intel.com>
> An: "david" <david@sigma-star.at>
> CC: "oe-kbuild-all" <oe-kbuild-all@lists.linux.dev>, "linux-kernel" <linux-kernel@vger.kernel.org>, "Jarkko Sakkinen"
> <jarkko@kernel.org>, "richard" <richard@nod.at>, "david oberhollenzer" <david.oberhollenzer@sigma-star.at>
> Gesendet: Freitag, 24. Mai 2024 00:48:26
> Betreff: security/keys/trusted-keys/trusted_dcp.c:206:24: sparse: sparse: incorrect type in assignment (different base
> types)
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
> master
> head: 6d69b6c12fce479fde7bc06f686212451688a102
> commit: 2e8a0f40a39cc253002f21c54e1b5b995e5ec510 KEYS: trusted: Introduce NXP
> DCP-backed trusted keys
> date: 2 weeks ago
> config: arm-randconfig-r112-20240524
> (https://download.01.org/0day-ci/archive/20240524/202405240610.fj53EK0q-lkp@intel.com/config)
> compiler: arm-linux-gnueabi-gcc (GCC) 13.2.0
> reproduce:
> (https://download.01.org/0day-ci/archive/20240524/202405240610.fj53EK0q-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
>| 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).
Thanks,
//richard
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: security/keys/trusted-keys/trusted_dcp.c:206:24: sparse: sparse: incorrect type in assignment (different base types)
2024-05-24 21:06 ` Richard Weinberger
@ 2024-05-24 21:24 ` Jarkko Sakkinen
2024-05-24 21:27 ` Richard Weinberger
0 siblings, 1 reply; 5+ messages in thread
From: Jarkko Sakkinen @ 2024-05-24 21:24 UTC (permalink / raw)
To: Richard Weinberger, kernel test robot
Cc: david, oe-kbuild-all, linux-kernel, david oberhollenzer
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
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: security/keys/trusted-keys/trusted_dcp.c:206:24: sparse: sparse: incorrect type in assignment (different base types)
2024-05-24 21:24 ` Jarkko Sakkinen
@ 2024-05-24 21:27 ` Richard Weinberger
2024-05-24 22:21 ` Jarkko Sakkinen
0 siblings, 1 reply; 5+ messages in thread
From: Richard Weinberger @ 2024-05-24 21:27 UTC (permalink / raw)
To: Jarkko Sakkinen
Cc: kernel test robot, david, oe-kbuild-all, linux-kernel,
david oberhollenzer
----- Ursprüngliche Mail -----
> Von: "Jarkko Sakkinen" <jarkko@kernel.org>
> An: "richard" <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>
> 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@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:
Sure. Let me first talk to David and give it a test...
Thanks,
//richard
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: security/keys/trusted-keys/trusted_dcp.c:206:24: sparse: sparse: incorrect type in assignment (different base types)
2024-05-24 21:27 ` Richard Weinberger
@ 2024-05-24 22:21 ` Jarkko Sakkinen
0 siblings, 0 replies; 5+ messages in thread
From: Jarkko Sakkinen @ 2024-05-24 22:21 UTC (permalink / raw)
To: Richard Weinberger
Cc: kernel test robot, david, oe-kbuild-all, linux-kernel,
david oberhollenzer
On Sat May 25, 2024 at 12:27 AM EEST, Richard Weinberger wrote:
> > Please send then fix, reasoning of that, and finally:
> Sure. Let me first talk to David and give it a test...
No rush
BR, Jarkko
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-05-24 22:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2024-05-24 21:27 ` Richard Weinberger
2024-05-24 22:21 ` Jarkko Sakkinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox