* [l1k:spdm-future 11/20] lib/spdm_requester.c:640:12: warning: cast to smaller integer type '__le16' (aka 'unsigned short') from '__le16 *' (aka 'unsigned short *')
@ 2024-02-07 2:16 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-02-07 2:16 UTC (permalink / raw)
To: Lukas Wunner; +Cc: oe-kbuild-all
Hi Jonathan,
First bad commit (maybe != root cause):
tree: https://github.com/l1k/linux spdm-future
head: 7465f757aed79b09d3374cd8837a8ce6c6f680b4
commit: b79c31b2ef9ea1fc70f9a7b4ae2741acd1130a52 [11/20] PCI/CMA: Authenticate devices on enumeration
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20240207/202402071048.lBJSQmW7-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 7dd790db8b77c4a833c06632e903dc4f13877a64)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240207/202402071048.lBJSQmW7-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/202402071048.lBJSQmW7-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> lib/spdm_requester.c:640:12: warning: cast to smaller integer type '__le16' (aka 'unsigned short') from '__le16 *' (aka 'unsigned short *') [-Wpointer-to-int-cast]
640 | u8 ver = le16_to_cpu(&rsp->version_number_entries[i]) >> 8;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/byteorder/generic.h:91:21: note: expanded from macro 'le16_to_cpu'
91 | #define le16_to_cpu __le16_to_cpu
| ^
include/uapi/linux/byteorder/big_endian.h:37:50: note: expanded from macro '__le16_to_cpu'
37 | #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16'
102 | #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
| ^
1 warning generated.
vim +640 lib/spdm_requester.c
1dd2850424470c Jonathan Cameron 2022-09-06 612
1dd2850424470c Jonathan Cameron 2022-09-06 613 static int spdm_get_version(struct spdm_state *spdm_state,
1dd2850424470c Jonathan Cameron 2022-09-06 614 void *transcript, size_t *transcript_sz)
1dd2850424470c Jonathan Cameron 2022-09-06 615 {
1dd2850424470c Jonathan Cameron 2022-09-06 616 struct spdm_get_version_rsp *rsp = transcript;
1dd2850424470c Jonathan Cameron 2022-09-06 617 u8 version = SPDM_MIN_VER;
1dd2850424470c Jonathan Cameron 2022-09-06 618 bool foundver = false;
1dd2850424470c Jonathan Cameron 2022-09-06 619 int rc, length, i;
1dd2850424470c Jonathan Cameron 2022-09-06 620
1dd2850424470c Jonathan Cameron 2022-09-06 621 /*
1dd2850424470c Jonathan Cameron 2022-09-06 622 * Bypass spdm_exchange() to be able to set version = 0x10.
1dd2850424470c Jonathan Cameron 2022-09-06 623 * rsp buffer is large enough for the maximum possible 255 entries.
1dd2850424470c Jonathan Cameron 2022-09-06 624 */
1dd2850424470c Jonathan Cameron 2022-09-06 625 rc = __spdm_exchange(spdm_state, &spdm_get_version_req,
1dd2850424470c Jonathan Cameron 2022-09-06 626 sizeof(spdm_get_version_req), rsp,
1dd2850424470c Jonathan Cameron 2022-09-06 627 struct_size(rsp, version_number_entries, 255));
1dd2850424470c Jonathan Cameron 2022-09-06 628 if (rc < 0)
1dd2850424470c Jonathan Cameron 2022-09-06 629 return rc;
1dd2850424470c Jonathan Cameron 2022-09-06 630
1dd2850424470c Jonathan Cameron 2022-09-06 631 length = rc;
1dd2850424470c Jonathan Cameron 2022-09-06 632 if (length < sizeof(*rsp) ||
1dd2850424470c Jonathan Cameron 2022-09-06 633 length < struct_size(rsp, version_number_entries,
1dd2850424470c Jonathan Cameron 2022-09-06 634 rsp->version_number_entry_count)) {
1dd2850424470c Jonathan Cameron 2022-09-06 635 dev_err(spdm_state->dev, "Truncated version response\n");
1dd2850424470c Jonathan Cameron 2022-09-06 636 return -EIO;
1dd2850424470c Jonathan Cameron 2022-09-06 637 }
1dd2850424470c Jonathan Cameron 2022-09-06 638
1dd2850424470c Jonathan Cameron 2022-09-06 639 for (i = 0; i < rsp->version_number_entry_count; i++) {
1dd2850424470c Jonathan Cameron 2022-09-06 @640 u8 ver = le16_to_cpu(&rsp->version_number_entries[i]) >> 8;
1dd2850424470c Jonathan Cameron 2022-09-06 641
1dd2850424470c Jonathan Cameron 2022-09-06 642 if (ver >= version && ver <= SPDM_MAX_VER) {
1dd2850424470c Jonathan Cameron 2022-09-06 643 foundver = true;
1dd2850424470c Jonathan Cameron 2022-09-06 644 version = ver;
1dd2850424470c Jonathan Cameron 2022-09-06 645 }
1dd2850424470c Jonathan Cameron 2022-09-06 646 }
1dd2850424470c Jonathan Cameron 2022-09-06 647 if (!foundver) {
1dd2850424470c Jonathan Cameron 2022-09-06 648 dev_err(spdm_state->dev, "No common supported version\n");
1dd2850424470c Jonathan Cameron 2022-09-06 649 return -EPROTO;
1dd2850424470c Jonathan Cameron 2022-09-06 650 }
1dd2850424470c Jonathan Cameron 2022-09-06 651 spdm_state->version = version;
1dd2850424470c Jonathan Cameron 2022-09-06 652
1dd2850424470c Jonathan Cameron 2022-09-06 653 /*
1dd2850424470c Jonathan Cameron 2022-09-06 654 * Stash VERSION response in transcript buffer
1dd2850424470c Jonathan Cameron 2022-09-06 655 * for later consumption by spdm_start_hash() when hash algo is known.
1dd2850424470c Jonathan Cameron 2022-09-06 656 */
1dd2850424470c Jonathan Cameron 2022-09-06 657 *transcript_sz = struct_size(rsp, version_number_entries,
1dd2850424470c Jonathan Cameron 2022-09-06 658 rsp->version_number_entry_count);
1dd2850424470c Jonathan Cameron 2022-09-06 659
1dd2850424470c Jonathan Cameron 2022-09-06 660 return 0;
1dd2850424470c Jonathan Cameron 2022-09-06 661 }
1dd2850424470c Jonathan Cameron 2022-09-06 662
:::::: The code at line 640 was first introduced by commit
:::::: 1dd2850424470c3e0da2018d6b23c0de0ceb2917 spdm: Introduce library to authenticate devices
:::::: TO: Jonathan Cameron <Jonathan.Cameron@huawei.com>
:::::: CC: Lukas Wunner <lukas@wunner.de>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-02-07 2:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-07 2:16 [l1k:spdm-future 11/20] lib/spdm_requester.c:640:12: warning: cast to smaller integer type '__le16' (aka 'unsigned short') from '__le16 *' (aka 'unsigned short *') kernel test robot
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.