Hi GONG,
FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.
tree: https://gitee.com/openeuler/kernel.git OLK-6.6 head: 7c547c6bbe6b6a9cedf63d7cdadb2529404df633 commit: 40151ef24c1a0f35c5e0442834eb776877e66683 [1474/1474] ima: rot: Prepare TPM as an RoT config: x86_64-rhel-8.3-kselftests (https://download.01.org/0day-ci/archive/20241117/202411170123.vN1EUOxu-lkp@i...) compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241117/202411170123.vN1EUOxu-lkp@i...)
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/202411170123.vN1EUOxu-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from security/integrity/ima/ima_tpm.c:12: In file included from include/linux/tpm.h:24: In file included from include/linux/highmem.h:8: In file included from include/linux/cacheflush.h:5: In file included from arch/x86/include/asm/cacheflush.h:5: In file included from include/linux/mm.h:2247: include/linux/vmstat.h:508:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion] 508 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS + | ~~~~~~~~~~~~~~~~~~~~~ ^ 509 | item]; | ~~~~ include/linux/vmstat.h:515:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion] 515 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS + | ~~~~~~~~~~~~~~~~~~~~~ ^ 516 | NR_VM_NUMA_EVENT_ITEMS + | ~~~~~~~~~~~~~~~~~~~~~~ include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion] 522 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_" | ~~~~~~~~~~~ ^ ~~~ include/linux/vmstat.h:527:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion] 527 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS + | ~~~~~~~~~~~~~~~~~~~~~ ^ 528 | NR_VM_NUMA_EVENT_ITEMS + | ~~~~~~~~~~~~~~~~~~~~~~ include/linux/vmstat.h:536:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion] 536 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS + | ~~~~~~~~~~~~~~~~~~~~~ ^ 537 | NR_VM_NUMA_EVENT_ITEMS + | ~~~~~~~~~~~~~~~~~~~~~~
security/integrity/ima/ima_tpm.c:19:6: warning: no previous prototype for function 'ima_pcrread' [-Wmissing-prototypes]
19 | void ima_pcrread(u32 idx, struct tpm_digest *d) | ^ security/integrity/ima/ima_tpm.c:19:1: note: declare 'static' if the function is not intended to be used outside of this translation unit 19 | void ima_pcrread(u32 idx, struct tpm_digest *d) | ^ | static security/integrity/ima/ima_tpm.c:28:5: warning: no previous prototype for function 'ima_pcr_extend' [-Wmissing-prototypes] 28 | int ima_pcr_extend(struct tpm_digest *digests_arg, int pcr) | ^ security/integrity/ima/ima_tpm.c:28:1: note: declare 'static' if the function is not intended to be used outside of this translation unit 28 | int ima_pcr_extend(struct tpm_digest *digests_arg, int pcr) | ^ | static
security/integrity/ima/ima_tpm.c:41:5: warning: no previous prototype for function 'ima_tpm_init' [-Wmissing-prototypes]
41 | int ima_tpm_init(struct ima_rot *rot) | ^ security/integrity/ima/ima_tpm.c:41:1: note: declare 'static' if the function is not intended to be used outside of this translation unit 41 | int ima_tpm_init(struct ima_rot *rot) | ^ | static
security/integrity/ima/ima_tpm.c:53:5: warning: no previous prototype for function 'ima_tpm_extend' [-Wmissing-prototypes]
53 | int ima_tpm_extend(struct tpm_digest *digests_arg, const void *args) | ^ security/integrity/ima/ima_tpm.c:53:1: note: declare 'static' if the function is not intended to be used outside of this translation unit 53 | int ima_tpm_extend(struct tpm_digest *digests_arg, const void *args) | ^ | static
security/integrity/ima/ima_tpm.c:60:5: warning: no previous prototype for function 'ima_tpm_calc_boot_aggregate' [-Wmissing-prototypes]
60 | int ima_tpm_calc_boot_aggregate(struct ima_digest_data *hash) | ^ security/integrity/ima/ima_tpm.c:60:1: note: declare 'static' if the function is not intended to be used outside of this translation unit 60 | int ima_tpm_calc_boot_aggregate(struct ima_digest_data *hash) | ^ | static 10 warnings generated.
vim +/ima_pcrread +19 security/integrity/ima/ima_tpm.c
18
19 void ima_pcrread(u32 idx, struct tpm_digest *d)
20 { 21 if (!ima_tpm_chip) 22 return; 23 24 if (tpm_pcr_read(ima_tpm_chip, idx, d) != 0) 25 pr_err("Error Communicating to TPM chip\n"); 26 } 27
28 int ima_pcr_extend(struct tpm_digest *digests_arg, int pcr)
29 { 30 int result = 0; 31 32 if (!ima_tpm_chip) 33 return result; 34 35 result = tpm_pcr_extend(ima_tpm_chip, pcr, digests_arg); 36 if (result != 0) 37 pr_err("Error Communicating to TPM chip, result: %d\n", result); 38 return result; 39 } 40
41 int ima_tpm_init(struct ima_rot *rot)
42 { 43 ima_tpm_chip = tpm_default_chip(); 44 if (!ima_tpm_chip) 45 return -ENODEV; 46 47 rot->nr_allocated_banks = ima_tpm_chip->nr_allocated_banks; 48 rot->allocated_banks = ima_tpm_chip->allocated_banks; 49 50 return 0; 51 } 52
53 int ima_tpm_extend(struct tpm_digest *digests_arg, const void *args)
54 { 55 const int pcr = *(const int *)args; 56 57 return ima_pcr_extend(digests_arg, pcr); 58 } 59
60 int ima_tpm_calc_boot_aggregate(struct ima_digest_data *hash)