* [jss-tpmdd:master 16/16] security/keys/trusted-keys/trusted_tpm1.c:201:19: sparse: sparse: cast to restricted __be32
@ 2019-10-12 1:35 kbuild test robot
2019-10-14 18:46 ` Jarkko Sakkinen
0 siblings, 1 reply; 3+ messages in thread
From: kbuild test robot @ 2019-10-12 1:35 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 17702 bytes --]
Hi Sumit,
First bad commit (maybe != root cause):
tree: git://git.infradead.org/users/jjs/linux-tpmdd master
head: 2feacb45cc29cf4fbb3783372ca096ea4d4fd761
commit: 2feacb45cc29cf4fbb3783372ca096ea4d4fd761 [16/16] KEYS: trusted: Create trusted keys subsystem
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-rc1-42-g38eda53-dirty
git checkout 2feacb45cc29cf4fbb3783372ca096ea4d4fd761
make ARCH=x86_64 allmodconfig
make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
sparse warnings: (new ones prefixed by >>)
>> security/keys/trusted-keys/trusted_tpm1.c:201:19: sparse: sparse: cast to restricted __be32
>> security/keys/trusted-keys/trusted_tpm1.c:201:19: sparse: sparse: cast to restricted __be32
>> security/keys/trusted-keys/trusted_tpm1.c:201:19: sparse: sparse: cast to restricted __be32
>> security/keys/trusted-keys/trusted_tpm1.c:201:19: sparse: sparse: cast to restricted __be32
>> security/keys/trusted-keys/trusted_tpm1.c:201:19: sparse: sparse: cast to restricted __be32
>> security/keys/trusted-keys/trusted_tpm1.c:201:19: sparse: sparse: cast to restricted __be32
>> security/keys/trusted-keys/trusted_tpm1.c:202:15: sparse: sparse: cast to restricted __be16
>> security/keys/trusted-keys/trusted_tpm1.c:202:15: sparse: sparse: cast to restricted __be16
>> security/keys/trusted-keys/trusted_tpm1.c:202:15: sparse: sparse: cast to restricted __be16
>> security/keys/trusted-keys/trusted_tpm1.c:202:15: sparse: sparse: cast to restricted __be16
security/keys/trusted-keys/trusted_tpm1.c:289:19: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:289:19: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:289:19: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:289:19: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:289:19: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:289:19: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:290:15: sparse: sparse: cast to restricted __be16
security/keys/trusted-keys/trusted_tpm1.c:290:15: sparse: sparse: cast to restricted __be16
security/keys/trusted-keys/trusted_tpm1.c:290:15: sparse: sparse: cast to restricted __be16
security/keys/trusted-keys/trusted_tpm1.c:290:15: sparse: sparse: cast to restricted __be16
security/keys/trusted-keys/trusted_tpm1.c:418:21: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:418:21: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:418:21: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:418:21: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:418:21: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:418:21: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:442:19: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:442:19: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:442:19: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:442:19: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:442:19: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:442:19: sparse: sparse: cast to restricted __be32
>> security/keys/trusted-keys/trusted_tpm1.c:501:17: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] ordinal @@ got restrunsigned int [usertype] ordinal @@
>> security/keys/trusted-keys/trusted_tpm1.c:501:17: sparse: expected unsigned int [usertype] ordinal
>> security/keys/trusted-keys/trusted_tpm1.c:501:17: sparse: got restricted __be32 [usertype]
>> security/keys/trusted-keys/trusted_tpm1.c:502:17: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] datsize @@ got restrunsigned int [usertype] datsize @@
>> security/keys/trusted-keys/trusted_tpm1.c:502:17: sparse: expected unsigned int [usertype] datsize
security/keys/trusted-keys/trusted_tpm1.c:502:17: sparse: got restricted __be32 [usertype]
>> security/keys/trusted-keys/trusted_tpm1.c:503:17: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] pcrsize @@ got restrunsigned int [usertype] pcrsize @@
>> security/keys/trusted-keys/trusted_tpm1.c:503:17: sparse: expected unsigned int [usertype] pcrsize
security/keys/trusted-keys/trusted_tpm1.c:503:17: sparse: got restricted __be32 [usertype]
security/keys/trusted-keys/trusted_tpm1.c:549:24: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:549:24: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:549:24: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:549:24: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:549:24: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:549:24: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:550:23: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:550:23: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:550:23: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:550:23: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:550:23: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:550:23: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:603:17: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] ordinal @@ got restrunsigned int [usertype] ordinal @@
security/keys/trusted-keys/trusted_tpm1.c:603:17: sparse: expected unsigned int [usertype] ordinal
security/keys/trusted-keys/trusted_tpm1.c:603:17: sparse: got restricted __be32 [usertype]
>> security/keys/trusted-keys/trusted_tpm1.c:604:17: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] keyhndl @@ got restrunsigned int [usertype] keyhndl @@
>> security/keys/trusted-keys/trusted_tpm1.c:604:17: sparse: expected unsigned int [usertype] keyhndl
security/keys/trusted-keys/trusted_tpm1.c:604:17: sparse: got restricted __be32 [usertype]
security/keys/trusted-keys/trusted_tpm1.c:640:20: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:640:20: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:640:20: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:640:20: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:640:20: sparse: sparse: cast to restricted __be32
security/keys/trusted-keys/trusted_tpm1.c:640:20: sparse: sparse: cast to restricted __be32
include/linux/tpm.h:318:9: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long addr @@ got unsigned chaunsigned long addr @@
include/linux/tpm.h:318:9: sparse: expected unsigned long addr
include/linux/tpm.h:318:9: sparse: got unsigned char [usertype] *data
include/linux/tpm.h:318:9: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long addr @@ got unsigned chaunsigned long addr @@
include/linux/tpm.h:318:9: sparse: expected unsigned long addr
include/linux/tpm.h:318:9: sparse: got unsigned char [usertype] *data
vim +201 security/keys/trusted-keys/trusted_tpm1.c
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 173
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 174 /*
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 175 * verify the AUTH1_COMMAND (Seal) result from TPM
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 176 */
e1ea9f86023e76 security/keys/trusted.c Denis Kenzior 2018-10-09 177 int TSS_checkhmac1(unsigned char *buffer,
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 178 const uint32_t command,
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 179 const unsigned char *ononce,
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 180 const unsigned char *key,
1bdbb4024c309e security/keys/trusted_defined.c Mimi Zohar 2010-12-13 181 unsigned int keylen, ...)
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 182 {
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 183 uint32_t bufsize;
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 184 uint16_t tag;
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 185 uint32_t ordinal;
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 186 uint32_t result;
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 187 unsigned char *enonce;
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 188 unsigned char *continueflag;
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 189 unsigned char *authdata;
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 190 unsigned char testhmac[SHA1_DIGEST_SIZE];
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 191 unsigned char paramdigest[SHA1_DIGEST_SIZE];
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 192 struct sdesc *sdesc;
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 193 unsigned int dlen;
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 194 unsigned int dpos;
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 195 va_list argp;
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 196 int ret;
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 197
c78719203fc629 security/keys/trusted.c Jarkko Sakkinen 2019-03-25 198 if (!chip)
c78719203fc629 security/keys/trusted.c Jarkko Sakkinen 2019-03-25 199 return -ENODEV;
c78719203fc629 security/keys/trusted.c Jarkko Sakkinen 2019-03-25 200
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 @201 bufsize = LOAD32(buffer, TPM_SIZE_OFFSET);
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 @202 tag = LOAD16(buffer, 0);
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 203 ordinal = command;
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 204 result = LOAD32N(buffer, TPM_RETURN_OFFSET);
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 205 if (tag == TPM_TAG_RSP_COMMAND)
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 206 return 0;
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 207 if (tag != TPM_TAG_RSP_AUTH1_COMMAND)
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 208 return -EINVAL;
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 209 authdata = buffer + bufsize - SHA1_DIGEST_SIZE;
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 210 continueflag = authdata - 1;
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 211 enonce = continueflag - TPM_NONCE_SIZE;
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 212
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 213 sdesc = init_sdesc(hashalg);
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 214 if (IS_ERR(sdesc)) {
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 215 pr_info("trusted_key: can't alloc %s\n", hash_alg);
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 216 return PTR_ERR(sdesc);
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 217 }
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 218 ret = crypto_shash_init(&sdesc->shash);
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 219 if (ret < 0)
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 220 goto out;
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 221 ret = crypto_shash_update(&sdesc->shash, (const u8 *)&result,
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 222 sizeof result);
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 223 if (ret < 0)
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 224 goto out;
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 225 ret = crypto_shash_update(&sdesc->shash, (const u8 *)&ordinal,
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 226 sizeof ordinal);
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 227 if (ret < 0)
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 228 goto out;
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 229 va_start(argp, keylen);
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 230 for (;;) {
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 231 dlen = va_arg(argp, unsigned int);
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 232 if (dlen == 0)
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 233 break;
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 234 dpos = va_arg(argp, unsigned int);
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 235 ret = crypto_shash_update(&sdesc->shash, buffer + dpos, dlen);
154a96bfcd53b8 security/keys/trusted_defined.c Tetsuo Handa 2011-01-17 236 if (ret < 0)
154a96bfcd53b8 security/keys/trusted_defined.c Tetsuo Handa 2011-01-17 237 break;
bc5e0af0b36b6c security/keys/trusted_defined.c Mimi Zohar 2010-12-13 238 }
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 239 va_end(argp);
154a96bfcd53b8 security/keys/trusted_defined.c Tetsuo Handa 2011-01-17 240 if (!ret)
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 241 ret = crypto_shash_final(&sdesc->shash, paramdigest);
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 242 if (ret < 0)
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 243 goto out;
bc5e0af0b36b6c security/keys/trusted_defined.c Mimi Zohar 2010-12-13 244
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 245 ret = TSS_rawhmac(testhmac, key, keylen, SHA1_DIGEST_SIZE, paramdigest,
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 246 TPM_NONCE_SIZE, enonce, TPM_NONCE_SIZE, ononce,
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 247 1, continueflag, 0, 0);
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 248 if (ret < 0)
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 249 goto out;
bc5e0af0b36b6c security/keys/trusted_defined.c Mimi Zohar 2010-12-13 250
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 251 if (memcmp(testhmac, authdata, SHA1_DIGEST_SIZE))
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 252 ret = -EINVAL;
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 253 out:
ee618b4619b725 security/keys/trusted.c Eric Biggers 2017-06-08 254 kzfree(sdesc);
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 255 return ret;
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 256 }
e1ea9f86023e76 security/keys/trusted.c Denis Kenzior 2018-10-09 257 EXPORT_SYMBOL_GPL(TSS_checkhmac1);
d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 258
:::::: The code@line 201 was first introduced by commit
:::::: d00a1c72f7f4661212299e6cb132dfa58030bcdb keys: add new trusted key-type
:::::: TO: Mimi Zohar <zohar@linux.vnet.ibm.com>
:::::: CC: James Morris <jmorris@namei.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [jss-tpmdd:master 16/16] security/keys/trusted-keys/trusted_tpm1.c:201:19: sparse: sparse: cast to restricted __be32
2019-10-12 1:35 [jss-tpmdd:master 16/16] security/keys/trusted-keys/trusted_tpm1.c:201:19: sparse: sparse: cast to restricted __be32 kbuild test robot
@ 2019-10-14 18:46 ` Jarkko Sakkinen
2019-10-15 8:25 ` Sumit Garg
0 siblings, 1 reply; 3+ messages in thread
From: Jarkko Sakkinen @ 2019-10-14 18:46 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 18276 bytes --]
On Sat, Oct 12, 2019 at 09:35:26AM +0800, kbuild test robot wrote:
> Hi Sumit,
>
> First bad commit (maybe != root cause):
>
> tree: git://git.infradead.org/users/jjs/linux-tpmdd master
> head: 2feacb45cc29cf4fbb3783372ca096ea4d4fd761
> commit: 2feacb45cc29cf4fbb3783372ca096ea4d4fd761 [16/16] KEYS: trusted: Create trusted keys subsystem
> reproduce:
> # apt-get install sparse
> # sparse version: v0.6.1-rc1-42-g38eda53-dirty
> git checkout 2feacb45cc29cf4fbb3783372ca096ea4d4fd761
> make ARCH=x86_64 allmodconfig
> make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
>
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@intel.com>
>
>
> sparse warnings: (new ones prefixed by >>)
>
> >> security/keys/trusted-keys/trusted_tpm1.c:201:19: sparse: sparse: cast to restricted __be32
> >> security/keys/trusted-keys/trusted_tpm1.c:201:19: sparse: sparse: cast to restricted __be32
> >> security/keys/trusted-keys/trusted_tpm1.c:201:19: sparse: sparse: cast to restricted __be32
> >> security/keys/trusted-keys/trusted_tpm1.c:201:19: sparse: sparse: cast to restricted __be32
> >> security/keys/trusted-keys/trusted_tpm1.c:201:19: sparse: sparse: cast to restricted __be32
> >> security/keys/trusted-keys/trusted_tpm1.c:201:19: sparse: sparse: cast to restricted __be32
> >> security/keys/trusted-keys/trusted_tpm1.c:202:15: sparse: sparse: cast to restricted __be16
> >> security/keys/trusted-keys/trusted_tpm1.c:202:15: sparse: sparse: cast to restricted __be16
> >> security/keys/trusted-keys/trusted_tpm1.c:202:15: sparse: sparse: cast to restricted __be16
> >> security/keys/trusted-keys/trusted_tpm1.c:202:15: sparse: sparse: cast to restricted __be16
> security/keys/trusted-keys/trusted_tpm1.c:289:19: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:289:19: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:289:19: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:289:19: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:289:19: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:289:19: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:290:15: sparse: sparse: cast to restricted __be16
> security/keys/trusted-keys/trusted_tpm1.c:290:15: sparse: sparse: cast to restricted __be16
> security/keys/trusted-keys/trusted_tpm1.c:290:15: sparse: sparse: cast to restricted __be16
> security/keys/trusted-keys/trusted_tpm1.c:290:15: sparse: sparse: cast to restricted __be16
> security/keys/trusted-keys/trusted_tpm1.c:418:21: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:418:21: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:418:21: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:418:21: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:418:21: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:418:21: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:442:19: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:442:19: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:442:19: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:442:19: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:442:19: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:442:19: sparse: sparse: cast to restricted __be32
> >> security/keys/trusted-keys/trusted_tpm1.c:501:17: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] ordinal @@ got restrunsigned int [usertype] ordinal @@
> >> security/keys/trusted-keys/trusted_tpm1.c:501:17: sparse: expected unsigned int [usertype] ordinal
> >> security/keys/trusted-keys/trusted_tpm1.c:501:17: sparse: got restricted __be32 [usertype]
> >> security/keys/trusted-keys/trusted_tpm1.c:502:17: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] datsize @@ got restrunsigned int [usertype] datsize @@
> >> security/keys/trusted-keys/trusted_tpm1.c:502:17: sparse: expected unsigned int [usertype] datsize
> security/keys/trusted-keys/trusted_tpm1.c:502:17: sparse: got restricted __be32 [usertype]
> >> security/keys/trusted-keys/trusted_tpm1.c:503:17: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] pcrsize @@ got restrunsigned int [usertype] pcrsize @@
> >> security/keys/trusted-keys/trusted_tpm1.c:503:17: sparse: expected unsigned int [usertype] pcrsize
> security/keys/trusted-keys/trusted_tpm1.c:503:17: sparse: got restricted __be32 [usertype]
> security/keys/trusted-keys/trusted_tpm1.c:549:24: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:549:24: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:549:24: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:549:24: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:549:24: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:549:24: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:550:23: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:550:23: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:550:23: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:550:23: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:550:23: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:550:23: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:603:17: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] ordinal @@ got restrunsigned int [usertype] ordinal @@
> security/keys/trusted-keys/trusted_tpm1.c:603:17: sparse: expected unsigned int [usertype] ordinal
> security/keys/trusted-keys/trusted_tpm1.c:603:17: sparse: got restricted __be32 [usertype]
> >> security/keys/trusted-keys/trusted_tpm1.c:604:17: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] keyhndl @@ got restrunsigned int [usertype] keyhndl @@
> >> security/keys/trusted-keys/trusted_tpm1.c:604:17: sparse: expected unsigned int [usertype] keyhndl
> security/keys/trusted-keys/trusted_tpm1.c:604:17: sparse: got restricted __be32 [usertype]
> security/keys/trusted-keys/trusted_tpm1.c:640:20: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:640:20: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:640:20: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:640:20: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:640:20: sparse: sparse: cast to restricted __be32
> security/keys/trusted-keys/trusted_tpm1.c:640:20: sparse: sparse: cast to restricted __be32
> include/linux/tpm.h:318:9: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long addr @@ got unsigned chaunsigned long addr @@
> include/linux/tpm.h:318:9: sparse: expected unsigned long addr
> include/linux/tpm.h:318:9: sparse: got unsigned char [usertype] *data
> include/linux/tpm.h:318:9: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long addr @@ got unsigned chaunsigned long addr @@
> include/linux/tpm.h:318:9: sparse: expected unsigned long addr
> include/linux/tpm.h:318:9: sparse: got unsigned char [usertype] *data
>
> vim +201 security/keys/trusted-keys/trusted_tpm1.c
>
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 173
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 174 /*
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 175 * verify the AUTH1_COMMAND (Seal) result from TPM
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 176 */
> e1ea9f86023e76 security/keys/trusted.c Denis Kenzior 2018-10-09 177 int TSS_checkhmac1(unsigned char *buffer,
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 178 const uint32_t command,
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 179 const unsigned char *ononce,
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 180 const unsigned char *key,
> 1bdbb4024c309e security/keys/trusted_defined.c Mimi Zohar 2010-12-13 181 unsigned int keylen, ...)
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 182 {
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 183 uint32_t bufsize;
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 184 uint16_t tag;
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 185 uint32_t ordinal;
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 186 uint32_t result;
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 187 unsigned char *enonce;
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 188 unsigned char *continueflag;
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 189 unsigned char *authdata;
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 190 unsigned char testhmac[SHA1_DIGEST_SIZE];
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 191 unsigned char paramdigest[SHA1_DIGEST_SIZE];
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 192 struct sdesc *sdesc;
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 193 unsigned int dlen;
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 194 unsigned int dpos;
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 195 va_list argp;
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 196 int ret;
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 197
> c78719203fc629 security/keys/trusted.c Jarkko Sakkinen 2019-03-25 198 if (!chip)
> c78719203fc629 security/keys/trusted.c Jarkko Sakkinen 2019-03-25 199 return -ENODEV;
> c78719203fc629 security/keys/trusted.c Jarkko Sakkinen 2019-03-25 200
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 @201 bufsize = LOAD32(buffer, TPM_SIZE_OFFSET);
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 @202 tag = LOAD16(buffer, 0);
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 203 ordinal = command;
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 204 result = LOAD32N(buffer, TPM_RETURN_OFFSET);
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 205 if (tag == TPM_TAG_RSP_COMMAND)
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 206 return 0;
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 207 if (tag != TPM_TAG_RSP_AUTH1_COMMAND)
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 208 return -EINVAL;
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 209 authdata = buffer + bufsize - SHA1_DIGEST_SIZE;
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 210 continueflag = authdata - 1;
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 211 enonce = continueflag - TPM_NONCE_SIZE;
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 212
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 213 sdesc = init_sdesc(hashalg);
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 214 if (IS_ERR(sdesc)) {
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 215 pr_info("trusted_key: can't alloc %s\n", hash_alg);
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 216 return PTR_ERR(sdesc);
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 217 }
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 218 ret = crypto_shash_init(&sdesc->shash);
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 219 if (ret < 0)
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 220 goto out;
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 221 ret = crypto_shash_update(&sdesc->shash, (const u8 *)&result,
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 222 sizeof result);
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 223 if (ret < 0)
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 224 goto out;
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 225 ret = crypto_shash_update(&sdesc->shash, (const u8 *)&ordinal,
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 226 sizeof ordinal);
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 227 if (ret < 0)
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 228 goto out;
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 229 va_start(argp, keylen);
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 230 for (;;) {
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 231 dlen = va_arg(argp, unsigned int);
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 232 if (dlen == 0)
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 233 break;
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 234 dpos = va_arg(argp, unsigned int);
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 235 ret = crypto_shash_update(&sdesc->shash, buffer + dpos, dlen);
> 154a96bfcd53b8 security/keys/trusted_defined.c Tetsuo Handa 2011-01-17 236 if (ret < 0)
> 154a96bfcd53b8 security/keys/trusted_defined.c Tetsuo Handa 2011-01-17 237 break;
> bc5e0af0b36b6c security/keys/trusted_defined.c Mimi Zohar 2010-12-13 238 }
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 239 va_end(argp);
> 154a96bfcd53b8 security/keys/trusted_defined.c Tetsuo Handa 2011-01-17 240 if (!ret)
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 241 ret = crypto_shash_final(&sdesc->shash, paramdigest);
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 242 if (ret < 0)
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 243 goto out;
> bc5e0af0b36b6c security/keys/trusted_defined.c Mimi Zohar 2010-12-13 244
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 245 ret = TSS_rawhmac(testhmac, key, keylen, SHA1_DIGEST_SIZE, paramdigest,
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 246 TPM_NONCE_SIZE, enonce, TPM_NONCE_SIZE, ononce,
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 247 1, continueflag, 0, 0);
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 248 if (ret < 0)
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 249 goto out;
> bc5e0af0b36b6c security/keys/trusted_defined.c Mimi Zohar 2010-12-13 250
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 251 if (memcmp(testhmac, authdata, SHA1_DIGEST_SIZE))
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 252 ret = -EINVAL;
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 253 out:
> ee618b4619b725 security/keys/trusted.c Eric Biggers 2017-06-08 254 kzfree(sdesc);
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 255 return ret;
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 256 }
> e1ea9f86023e76 security/keys/trusted.c Denis Kenzior 2018-10-09 257 EXPORT_SYMBOL_GPL(TSS_checkhmac1);
> d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 258
>
> :::::: The code at line 201 was first introduced by commit
> :::::: d00a1c72f7f4661212299e6cb132dfa58030bcdb keys: add new trusted key-type
>
> :::::: TO: Mimi Zohar <zohar@linux.vnet.ibm.com>
> :::::: CC: James Morris <jmorris@namei.org>
>
> ---
> 0-DAY kernel test infrastructure Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all Intel Corporation
Sumit, can you send a one more iteration with fixes for kbuild issues?
I'm taking off the existing commits.
/Jarkko
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [jss-tpmdd:master 16/16] security/keys/trusted-keys/trusted_tpm1.c:201:19: sparse: sparse: cast to restricted __be32
2019-10-14 18:46 ` Jarkko Sakkinen
@ 2019-10-15 8:25 ` Sumit Garg
0 siblings, 0 replies; 3+ messages in thread
From: Sumit Garg @ 2019-10-15 8:25 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 19728 bytes --]
On Tue, 15 Oct 2019 at 00:16, Jarkko Sakkinen
<jarkko.sakkinen@linux.intel.com> wrote:
>
> On Sat, Oct 12, 2019 at 09:35:26AM +0800, kbuild test robot wrote:
> > Hi Sumit,
> >
> > First bad commit (maybe != root cause):
> >
> > tree: git://git.infradead.org/users/jjs/linux-tpmdd master
> > head: 2feacb45cc29cf4fbb3783372ca096ea4d4fd761
> > commit: 2feacb45cc29cf4fbb3783372ca096ea4d4fd761 [16/16] KEYS: trusted: Create trusted keys subsystem
> > reproduce:
> > # apt-get install sparse
> > # sparse version: v0.6.1-rc1-42-g38eda53-dirty
> > git checkout 2feacb45cc29cf4fbb3783372ca096ea4d4fd761
> > make ARCH=x86_64 allmodconfig
> > make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
> >
> > If you fix the issue, kindly add following tag
> > Reported-by: kbuild test robot <lkp@intel.com>
> >
> >
> > sparse warnings: (new ones prefixed by >>)
> >
> > >> security/keys/trusted-keys/trusted_tpm1.c:201:19: sparse: sparse: cast to restricted __be32
> > >> security/keys/trusted-keys/trusted_tpm1.c:201:19: sparse: sparse: cast to restricted __be32
> > >> security/keys/trusted-keys/trusted_tpm1.c:201:19: sparse: sparse: cast to restricted __be32
> > >> security/keys/trusted-keys/trusted_tpm1.c:201:19: sparse: sparse: cast to restricted __be32
> > >> security/keys/trusted-keys/trusted_tpm1.c:201:19: sparse: sparse: cast to restricted __be32
> > >> security/keys/trusted-keys/trusted_tpm1.c:201:19: sparse: sparse: cast to restricted __be32
> > >> security/keys/trusted-keys/trusted_tpm1.c:202:15: sparse: sparse: cast to restricted __be16
> > >> security/keys/trusted-keys/trusted_tpm1.c:202:15: sparse: sparse: cast to restricted __be16
> > >> security/keys/trusted-keys/trusted_tpm1.c:202:15: sparse: sparse: cast to restricted __be16
> > >> security/keys/trusted-keys/trusted_tpm1.c:202:15: sparse: sparse: cast to restricted __be16
> > security/keys/trusted-keys/trusted_tpm1.c:289:19: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:289:19: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:289:19: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:289:19: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:289:19: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:289:19: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:290:15: sparse: sparse: cast to restricted __be16
> > security/keys/trusted-keys/trusted_tpm1.c:290:15: sparse: sparse: cast to restricted __be16
> > security/keys/trusted-keys/trusted_tpm1.c:290:15: sparse: sparse: cast to restricted __be16
> > security/keys/trusted-keys/trusted_tpm1.c:290:15: sparse: sparse: cast to restricted __be16
> > security/keys/trusted-keys/trusted_tpm1.c:418:21: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:418:21: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:418:21: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:418:21: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:418:21: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:418:21: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:442:19: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:442:19: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:442:19: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:442:19: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:442:19: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:442:19: sparse: sparse: cast to restricted __be32
> > >> security/keys/trusted-keys/trusted_tpm1.c:501:17: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] ordinal @@ got restrunsigned int [usertype] ordinal @@
> > >> security/keys/trusted-keys/trusted_tpm1.c:501:17: sparse: expected unsigned int [usertype] ordinal
> > >> security/keys/trusted-keys/trusted_tpm1.c:501:17: sparse: got restricted __be32 [usertype]
> > >> security/keys/trusted-keys/trusted_tpm1.c:502:17: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] datsize @@ got restrunsigned int [usertype] datsize @@
> > >> security/keys/trusted-keys/trusted_tpm1.c:502:17: sparse: expected unsigned int [usertype] datsize
> > security/keys/trusted-keys/trusted_tpm1.c:502:17: sparse: got restricted __be32 [usertype]
> > >> security/keys/trusted-keys/trusted_tpm1.c:503:17: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] pcrsize @@ got restrunsigned int [usertype] pcrsize @@
> > >> security/keys/trusted-keys/trusted_tpm1.c:503:17: sparse: expected unsigned int [usertype] pcrsize
> > security/keys/trusted-keys/trusted_tpm1.c:503:17: sparse: got restricted __be32 [usertype]
> > security/keys/trusted-keys/trusted_tpm1.c:549:24: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:549:24: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:549:24: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:549:24: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:549:24: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:549:24: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:550:23: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:550:23: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:550:23: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:550:23: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:550:23: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:550:23: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:603:17: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] ordinal @@ got restrunsigned int [usertype] ordinal @@
> > security/keys/trusted-keys/trusted_tpm1.c:603:17: sparse: expected unsigned int [usertype] ordinal
> > security/keys/trusted-keys/trusted_tpm1.c:603:17: sparse: got restricted __be32 [usertype]
> > >> security/keys/trusted-keys/trusted_tpm1.c:604:17: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] keyhndl @@ got restrunsigned int [usertype] keyhndl @@
> > >> security/keys/trusted-keys/trusted_tpm1.c:604:17: sparse: expected unsigned int [usertype] keyhndl
> > security/keys/trusted-keys/trusted_tpm1.c:604:17: sparse: got restricted __be32 [usertype]
> > security/keys/trusted-keys/trusted_tpm1.c:640:20: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:640:20: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:640:20: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:640:20: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:640:20: sparse: sparse: cast to restricted __be32
> > security/keys/trusted-keys/trusted_tpm1.c:640:20: sparse: sparse: cast to restricted __be32
> > include/linux/tpm.h:318:9: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long addr @@ got unsigned chaunsigned long addr @@
> > include/linux/tpm.h:318:9: sparse: expected unsigned long addr
> > include/linux/tpm.h:318:9: sparse: got unsigned char [usertype] *data
> > include/linux/tpm.h:318:9: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned long addr @@ got unsigned chaunsigned long addr @@
> > include/linux/tpm.h:318:9: sparse: expected unsigned long addr
> > include/linux/tpm.h:318:9: sparse: got unsigned char [usertype] *data
> >
> > vim +201 security/keys/trusted-keys/trusted_tpm1.c
> >
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 173
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 174 /*
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 175 * verify the AUTH1_COMMAND (Seal) result from TPM
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 176 */
> > e1ea9f86023e76 security/keys/trusted.c Denis Kenzior 2018-10-09 177 int TSS_checkhmac1(unsigned char *buffer,
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 178 const uint32_t command,
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 179 const unsigned char *ononce,
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 180 const unsigned char *key,
> > 1bdbb4024c309e security/keys/trusted_defined.c Mimi Zohar 2010-12-13 181 unsigned int keylen, ...)
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 182 {
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 183 uint32_t bufsize;
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 184 uint16_t tag;
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 185 uint32_t ordinal;
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 186 uint32_t result;
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 187 unsigned char *enonce;
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 188 unsigned char *continueflag;
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 189 unsigned char *authdata;
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 190 unsigned char testhmac[SHA1_DIGEST_SIZE];
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 191 unsigned char paramdigest[SHA1_DIGEST_SIZE];
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 192 struct sdesc *sdesc;
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 193 unsigned int dlen;
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 194 unsigned int dpos;
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 195 va_list argp;
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 196 int ret;
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 197
> > c78719203fc629 security/keys/trusted.c Jarkko Sakkinen 2019-03-25 198 if (!chip)
> > c78719203fc629 security/keys/trusted.c Jarkko Sakkinen 2019-03-25 199 return -ENODEV;
> > c78719203fc629 security/keys/trusted.c Jarkko Sakkinen 2019-03-25 200
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 @201 bufsize = LOAD32(buffer, TPM_SIZE_OFFSET);
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 @202 tag = LOAD16(buffer, 0);
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 203 ordinal = command;
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 204 result = LOAD32N(buffer, TPM_RETURN_OFFSET);
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 205 if (tag == TPM_TAG_RSP_COMMAND)
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 206 return 0;
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 207 if (tag != TPM_TAG_RSP_AUTH1_COMMAND)
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 208 return -EINVAL;
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 209 authdata = buffer + bufsize - SHA1_DIGEST_SIZE;
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 210 continueflag = authdata - 1;
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 211 enonce = continueflag - TPM_NONCE_SIZE;
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 212
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 213 sdesc = init_sdesc(hashalg);
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 214 if (IS_ERR(sdesc)) {
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 215 pr_info("trusted_key: can't alloc %s\n", hash_alg);
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 216 return PTR_ERR(sdesc);
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 217 }
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 218 ret = crypto_shash_init(&sdesc->shash);
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 219 if (ret < 0)
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 220 goto out;
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 221 ret = crypto_shash_update(&sdesc->shash, (const u8 *)&result,
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 222 sizeof result);
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 223 if (ret < 0)
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 224 goto out;
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 225 ret = crypto_shash_update(&sdesc->shash, (const u8 *)&ordinal,
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 226 sizeof ordinal);
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 227 if (ret < 0)
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 228 goto out;
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 229 va_start(argp, keylen);
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 230 for (;;) {
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 231 dlen = va_arg(argp, unsigned int);
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 232 if (dlen == 0)
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 233 break;
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 234 dpos = va_arg(argp, unsigned int);
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 235 ret = crypto_shash_update(&sdesc->shash, buffer + dpos, dlen);
> > 154a96bfcd53b8 security/keys/trusted_defined.c Tetsuo Handa 2011-01-17 236 if (ret < 0)
> > 154a96bfcd53b8 security/keys/trusted_defined.c Tetsuo Handa 2011-01-17 237 break;
> > bc5e0af0b36b6c security/keys/trusted_defined.c Mimi Zohar 2010-12-13 238 }
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 239 va_end(argp);
> > 154a96bfcd53b8 security/keys/trusted_defined.c Tetsuo Handa 2011-01-17 240 if (!ret)
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 241 ret = crypto_shash_final(&sdesc->shash, paramdigest);
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 242 if (ret < 0)
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 243 goto out;
> > bc5e0af0b36b6c security/keys/trusted_defined.c Mimi Zohar 2010-12-13 244
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 245 ret = TSS_rawhmac(testhmac, key, keylen, SHA1_DIGEST_SIZE, paramdigest,
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 246 TPM_NONCE_SIZE, enonce, TPM_NONCE_SIZE, ononce,
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 247 1, continueflag, 0, 0);
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 248 if (ret < 0)
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 249 goto out;
> > bc5e0af0b36b6c security/keys/trusted_defined.c Mimi Zohar 2010-12-13 250
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 251 if (memcmp(testhmac, authdata, SHA1_DIGEST_SIZE))
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 252 ret = -EINVAL;
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 253 out:
> > ee618b4619b725 security/keys/trusted.c Eric Biggers 2017-06-08 254 kzfree(sdesc);
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 255 return ret;
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 256 }
> > e1ea9f86023e76 security/keys/trusted.c Denis Kenzior 2018-10-09 257 EXPORT_SYMBOL_GPL(TSS_checkhmac1);
> > d00a1c72f7f466 security/keys/trusted_defined.c Mimi Zohar 2010-11-23 258
> >
> > :::::: The code at line 201 was first introduced by commit
> > :::::: d00a1c72f7f4661212299e6cb132dfa58030bcdb keys: add new trusted key-type
> >
> > :::::: TO: Mimi Zohar <zohar@linux.vnet.ibm.com>
> > :::::: CC: James Morris <jmorris@namei.org>
> >
> > ---
> > 0-DAY kernel test infrastructure Open Source Technology Center
> > https://lists.01.org/pipermail/kbuild-all Intel Corporation
>
> Sumit, can you send a one more iteration with fixes for kbuild issues?
> I'm taking off the existing commits.
>
These kbuild issues aren't caused by "KEYS: trusted: Create trusted
keys subsystem" as this commit only did a rename from
"security/keys/trusted.c" ->
"security/keys/trusted-keys/trusted_tpm1.c".
So I think there should be a separate patch to fix all the sparse
issues that existed in "security/keys/trusted.c" rather than updating
this patch.
-Sumit
> /Jarkko
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-15 8:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-12 1:35 [jss-tpmdd:master 16/16] security/keys/trusted-keys/trusted_tpm1.c:201:19: sparse: sparse: cast to restricted __be32 kbuild test robot
2019-10-14 18:46 ` Jarkko Sakkinen
2019-10-15 8:25 ` Sumit Garg
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.