tree: https://gitee.com/openeuler/kernel.git OLK-5.10 head: 020e0507954f21291b7b3a0a280128270a0d8959 commit: 2c0768b2f0838b4a365d958abd751773e795e987 [2516/2516] ima: Add ima_show_template_uint() template library function config: x86_64-randconfig-121-20241203 (https://download.01.org/0day-ci/archive/20241203/202412031310.oFwEBFj9-lkp@i...) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241203/202412031310.oFwEBFj9-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/202412031310.oFwEBFj9-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
security/integrity/ima/ima_template_lib.c:102:44: sparse: sparse: cast to restricted __le16
security/integrity/ima/ima_template_lib.c:109:44: sparse: sparse: cast to restricted __le32
security/integrity/ima/ima_template_lib.c:116:44: sparse: sparse: cast to restricted __le64
security/integrity/ima/ima_template_lib.c:137:60: sparse: sparse: restricted __le32 degrades to integer security/integrity/ima/ima_template_lib.c:232:49: sparse: sparse: cast to restricted __le32
vim +102 security/integrity/ima/ima_template_lib.c
66 67 static void ima_show_template_data_ascii(struct seq_file *m, 68 enum ima_show_type show, 69 enum data_formats datafmt, 70 struct ima_field_data *field_data) 71 { 72 u8 *buf_ptr = field_data->data; 73 u32 buflen = field_data->len; 74 75 switch (datafmt) { 76 case DATA_FMT_DIGEST_WITH_ALGO: 77 buf_ptr = strnchr(field_data->data, buflen, ':'); 78 if (buf_ptr != field_data->data) 79 seq_printf(m, "%s", field_data->data); 80 81 /* skip ':' and '\0' */ 82 buf_ptr += 2; 83 buflen -= buf_ptr - field_data->data; 84 fallthrough; 85 case DATA_FMT_DIGEST: 86 case DATA_FMT_HEX: 87 if (!buflen) 88 break; 89 ima_print_digest(m, buf_ptr, buflen); 90 break; 91 case DATA_FMT_STRING: 92 seq_printf(m, "%s", buf_ptr); 93 break; 94 case DATA_FMT_UINT: 95 switch (field_data->len) { 96 case sizeof(u8): 97 seq_printf(m, "%u", *(u8 *)buf_ptr); 98 break; 99 case sizeof(u16): 100 if (ima_canonical_fmt) 101 seq_printf(m, "%u",
102 le16_to_cpu(*(u16 *)buf_ptr));
103 else 104 seq_printf(m, "%u", *(u16 *)buf_ptr); 105 break; 106 case sizeof(u32): 107 if (ima_canonical_fmt) 108 seq_printf(m, "%u", 109 le32_to_cpu(*(u32 *)buf_ptr)); 110 else 111 seq_printf(m, "%u", *(u32 *)buf_ptr); 112 break; 113 case sizeof(u64): 114 if (ima_canonical_fmt) 115 seq_printf(m, "%llu",
116 le64_to_cpu(*(u64 *)buf_ptr));
117 else 118 seq_printf(m, "%llu", *(u64 *)buf_ptr); 119 break; 120 default: 121 break; 122 } 123 default: 124 break; 125 } 126 } 127