linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [integrity:next-integrity-testing 3/9] security/integrity/ima/ima_template_lib.c:100:44: sparse: sparse: cast to restricted __le16
@ 2021-06-04  6:56 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2021-06-04  6:56 UTC (permalink / raw)
  To: Roberto Sassu; +Cc: kbuild-all, linux-integrity, Mimi Zohar

[-- Attachment #1: Type: text/plain, Size: 3780 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity.git next-integrity-testing
head:   d721c15fd519c08819fbc6de39b713e2ed1d9894
commit: cde1391a0b4014b0e8fc09cd316272f478b54c0f [3/9] ima: Add ima_show_template_uint() template library function
config: nios2-randconfig-s031-20210604 (attached as .config)
compiler: nios2-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.3-341-g8af24329-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity.git/commit/?id=cde1391a0b4014b0e8fc09cd316272f478b54c0f
        git remote add integrity https://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity.git
        git fetch --no-tags integrity next-integrity-testing
        git checkout cde1391a0b4014b0e8fc09cd316272f478b54c0f
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=nios2 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
>> security/integrity/ima/ima_template_lib.c:100:44: sparse: sparse: cast to restricted __le16
   security/integrity/ima/ima_template_lib.c:107:44: sparse: sparse: cast to restricted __le32
>> security/integrity/ima/ima_template_lib.c:114:44: sparse: sparse: cast to restricted __le64
   security/integrity/ima/ima_template_lib.c:135:60: sparse: sparse: restricted __le32 degrades to integer
   security/integrity/ima/ima_template_lib.c:230:49: sparse: sparse: cast to restricted __le32

vim +100 security/integrity/ima/ima_template_lib.c

    64	
    65	static void ima_show_template_data_ascii(struct seq_file *m,
    66						 enum ima_show_type show,
    67						 enum data_formats datafmt,
    68						 struct ima_field_data *field_data)
    69	{
    70		u8 *buf_ptr = field_data->data;
    71		u32 buflen = field_data->len;
    72	
    73		switch (datafmt) {
    74		case DATA_FMT_DIGEST_WITH_ALGO:
    75			buf_ptr = strnchr(field_data->data, buflen, ':');
    76			if (buf_ptr != field_data->data)
    77				seq_printf(m, "%s", field_data->data);
    78	
    79			/* skip ':' and '\0' */
    80			buf_ptr += 2;
    81			buflen -= buf_ptr - field_data->data;
    82			fallthrough;
    83		case DATA_FMT_DIGEST:
    84		case DATA_FMT_HEX:
    85			if (!buflen)
    86				break;
    87			ima_print_digest(m, buf_ptr, buflen);
    88			break;
    89		case DATA_FMT_STRING:
    90			seq_printf(m, "%s", buf_ptr);
    91			break;
    92		case DATA_FMT_UINT:
    93			switch (field_data->len) {
    94			case sizeof(u8):
    95				seq_printf(m, "%u", *(u8 *)buf_ptr);
    96				break;
    97			case sizeof(u16):
    98				if (ima_canonical_fmt)
    99					seq_printf(m, "%u",
 > 100						   le16_to_cpu(*(u16 *)buf_ptr));
   101				else
   102					seq_printf(m, "%u", *(u16 *)buf_ptr);
   103				break;
   104			case sizeof(u32):
   105				if (ima_canonical_fmt)
   106					seq_printf(m, "%u",
   107						   le32_to_cpu(*(u32 *)buf_ptr));
   108				else
   109					seq_printf(m, "%u", *(u32 *)buf_ptr);
   110				break;
   111			case sizeof(u64):
   112				if (ima_canonical_fmt)
   113					seq_printf(m, "%llu",
 > 114						   le64_to_cpu(*(u64 *)buf_ptr));
   115				else
   116					seq_printf(m, "%llu", *(u64 *)buf_ptr);
   117				break;
   118			default:
   119				break;
   120			}
   121		default:
   122			break;
   123		}
   124	}
   125	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 21406 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-04  6:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-04  6:56 [integrity:next-integrity-testing 3/9] security/integrity/ima/ima_template_lib.c:100:44: sparse: sparse: cast to restricted __le16 kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).