[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202005280010.dXsJXy4W%lkp@intel.com>
Date: Thu, 28 May 2020 00:44:13 +0800
From: kbuild test robot <lkp@...el.com>
To: Rijo Thomas <Rijo-john.Thomas@....com>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
Herbert Xu <herbert@...dor.apana.org.au>,
Devaraj Rangasamy <Devaraj.Rangasamy@....com>
Subject: drivers/crypto/ccp/sev-dev.c:387:14: sparse: sparse: incorrect type
in argument 1 (different base types)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 444fc5cde64330661bf59944c43844e7d4c2ccd8
commit: 9b67d08dbc1751ab15d972a63a4d9132e7e7442f crypto: ccp - rename psp-dev files to sev-dev
date: 5 months ago
config: x86_64-randconfig-s031-20200527 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-240-gf0fe1cd9-dirty
git checkout 9b67d08dbc1751ab15d972a63a4d9132e7e7442f
# save the attached .config to linux build tree
make W=1 C=1 ARCH=x86_64 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@...el.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/crypto/ccp/sev-dev.c:387:14: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected void const volatile [noderef] <asn:1> * @@ got unsigned long long [addressable] [usertype] address @@
drivers/crypto/ccp/sev-dev.c:387:14: sparse: expected void const volatile [noderef] <asn:1> *
drivers/crypto/ccp/sev-dev.c:387:14: sparse: got unsigned long long [addressable] [usertype] address
drivers/crypto/ccp/sev-dev.c:626:14: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected void const volatile [noderef] <asn:1> * @@ got unsigned long long [addressable] [usertype] address @@
drivers/crypto/ccp/sev-dev.c:626:14: sparse: expected void const volatile [noderef] <asn:1> *
drivers/crypto/ccp/sev-dev.c:626:14: sparse: got unsigned long long [addressable] [usertype] address
>> drivers/crypto/ccp/sev-dev.c:744:14: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected void const volatile [noderef] <asn:1> * @@ got unsigned long long [addressable] [usertype] pdh_cert_address @@
drivers/crypto/ccp/sev-dev.c:744:14: sparse: expected void const volatile [noderef] <asn:1> *
drivers/crypto/ccp/sev-dev.c:744:14: sparse: got unsigned long long [addressable] [usertype] pdh_cert_address
>> drivers/crypto/ccp/sev-dev.c:751:14: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected void const volatile [noderef] <asn:1> * @@ got unsigned long long [addressable] [usertype] cert_chain_address @@
drivers/crypto/ccp/sev-dev.c:751:14: sparse: expected void const volatile [noderef] <asn:1> *
drivers/crypto/ccp/sev-dev.c:751:14: sparse: got unsigned long long [addressable] [usertype] cert_chain_address
drivers/crypto/ccp/sev-dev.c:433:14: sparse: sparse: dereference of noderef expression
drivers/crypto/ccp/sev-dev.c:440:54: sparse: sparse: dereference of noderef expression
vim +387 drivers/crypto/ccp/sev-dev.c
4d84b726be834d drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 364
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 365 static int sev_ioctl_do_pek_csr(struct sev_issue_cmd *argp)
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 366 {
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 367 struct sev_user_data_pek_csr input;
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 368 struct sev_data_pek_csr *data;
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 369 void *blob = NULL;
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 370 int ret;
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 371
ec310caf13b550 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2019-11-12 372 if (!capable(CAP_SYS_ADMIN))
ec310caf13b550 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2019-11-12 373 return -EPERM;
ec310caf13b550 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2019-11-12 374
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 375 if (copy_from_user(&input, (void __user *)argp->data, sizeof(input)))
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 376 return -EFAULT;
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 377
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 378 data = kzalloc(sizeof(*data), GFP_KERNEL);
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 379 if (!data)
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 380 return -ENOMEM;
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 381
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 382 /* userspace wants to query CSR length */
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 383 if (!input.address || !input.length)
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 384 goto cmd;
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 385
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 386 /* allocate a physically contiguous buffer to store the CSR blob */
96d4f267e40f95 drivers/crypto/ccp/psp-dev.c Linus Torvalds 2019-01-03 @387 if (!access_ok(input.address, input.length) ||
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 388 input.length > SEV_FW_BLOB_MAX_SIZE) {
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 389 ret = -EFAULT;
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 390 goto e_free;
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 391 }
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 392
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 393 blob = kmalloc(input.length, GFP_KERNEL);
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 394 if (!blob) {
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 395 ret = -ENOMEM;
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 396 goto e_free;
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 397 }
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 398
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 399 data->address = __psp_pa(blob);
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 400 data->len = input.length;
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 401
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 402 cmd:
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 403 if (psp_master->sev_state == SEV_STATE_UNINIT) {
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 404 ret = __sev_platform_init_locked(&argp->error);
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 405 if (ret)
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 406 goto e_free_blob;
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 407 }
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 408
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 409 ret = __sev_do_cmd_locked(SEV_CMD_PEK_CSR, data, &argp->error);
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 410
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 411 /* If we query the CSR length, FW responded with expected data. */
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 412 input.length = data->len;
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 413
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 414 if (copy_to_user((void __user *)argp->data, &input, sizeof(input))) {
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 415 ret = -EFAULT;
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 416 goto e_free_blob;
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 417 }
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 418
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 419 if (blob) {
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 420 if (copy_to_user((void __user *)input.address, blob, input.length))
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 421 ret = -EFAULT;
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 422 }
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 423
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 424 e_free_blob:
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 425 kfree(blob);
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 426 e_free:
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 427 kfree(data);
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 428 return ret;
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 429 }
e799035609e152 drivers/crypto/ccp/psp-dev.c Brijesh Singh 2017-12-04 430
:::::: The code at line 387 was first introduced by commit
:::::: 96d4f267e40f9509e8a66e2b39e8b95655617693 Remove 'type' argument from access_ok() function
:::::: TO: Linus Torvalds <torvalds@...ux-foundation.org>
:::::: CC: Linus Torvalds <torvalds@...ux-foundation.org>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (34889 bytes)
Powered by blists - more mailing lists