From: kbuild test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [jss-tpmdd:master 16/16] security/keys/trusted-keys/trusted_tpm1.c:201:19: sparse: sparse: cast to restricted __be32
Date: Sat, 12 Oct 2019 09:35:26 +0800 [thread overview]
Message-ID: <201910120922.qWSWDM0s%lkp@intel.com> (raw)
[-- 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
next reply other threads:[~2019-10-12 1:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-12 1:35 kbuild test robot [this message]
2019-10-14 18:46 ` [jss-tpmdd:master 16/16] security/keys/trusted-keys/trusted_tpm1.c:201:19: sparse: sparse: cast to restricted __be32 Jarkko Sakkinen
2019-10-15 8:25 ` Sumit Garg
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=201910120922.qWSWDM0s%lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild-all@lists.01.org \
/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 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.