tree: https://gitee.com/openeuler/kernel.git OLK-5.10 head: 020e0507954f21291b7b3a0a280128270a0d8959 commit: 3cc8c5969d7e15a044c4bd6d02ed1e82c060abd7 [2516/2516] ima: Define new template fields iuid and igid config: x86_64-randconfig-121-20241203 (https://download.01.org/0day-ci/archive/20241203/202412031511.qvHczHr1-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/202412031511.qvHczHr1-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/202412031511.qvHczHr1-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
security/integrity/ima/ima_template_lib.c:578:28: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [assigned] id @@ got restricted __le16 [usertype] @@
security/integrity/ima/ima_template_lib.c:578:28: sparse: expected unsigned int [assigned] id security/integrity/ima/ima_template_lib.c:578:28: sparse: got restricted __le16 [usertype]
security/integrity/ima/ima_template_lib.c:580:28: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [assigned] id @@ got restricted __le32 [usertype] @@
security/integrity/ima/ima_template_lib.c:580:28: sparse: expected unsigned int [assigned] id security/integrity/ima/ima_template_lib.c:580:28: sparse: got restricted __le32 [usertype]
vim +578 security/integrity/ima/ima_template_lib.c
561 562 static int ima_eventinodedac_init_common(struct ima_event_data *event_data, 563 struct ima_field_data *field_data, 564 bool get_uid) 565 { 566 unsigned int id; 567 568 if (!event_data->file) 569 return 0; 570 571 if (get_uid) 572 id = i_uid_read(file_inode(event_data->file)); 573 else 574 id = i_gid_read(file_inode(event_data->file)); 575 576 if (ima_canonical_fmt) { 577 if (sizeof(id) == sizeof(u16))
578 id = cpu_to_le16(id);
579 else
580 id = cpu_to_le32(id);
581 } 582 583 return ima_write_template_field_data((void *)&id, sizeof(id), 584 DATA_FMT_UINT, field_data); 585 } 586