lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202207062145.V55bHrHO-lkp@intel.com>
Date:   Wed, 6 Jul 2022 21:56:49 +0800
From:   kernel test robot <lkp@...el.com>
To:     Janne Grunau <j@...nau.net>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Hector Martin <marcan@...can.st>
Subject: [asahilinux:bits/090-spi-hid 11/11]
 drivers/hid/spi-hid/spi-hid-apple-core.c:709:17: sparse: sparse: cast from
 restricted __le16

tree:   https://github.com/AsahiLinux/linux bits/090-spi-hid
head:   42af7072aa3351c9a5716b754babb8ded16874ab
commit: 42af7072aa3351c9a5716b754babb8ded16874ab [11/11] WIP: HID: transport: spi: add Apple SPI transport
config: powerpc-randconfig-s031-20220706 (https://download.01.org/0day-ci/archive/20220706/202207062145.V55bHrHO-lkp@intel.com/config)
compiler: powerpc-linux-gcc (GCC) 11.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.4-39-gce1a6720-dirty
        # https://github.com/AsahiLinux/linux/commit/42af7072aa3351c9a5716b754babb8ded16874ab
        git remote add asahilinux https://github.com/AsahiLinux/linux
        git fetch --no-tags asahilinux bits/090-spi-hid
        git checkout 42af7072aa3351c9a5716b754babb8ded16874ab
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=powerpc SHELL=/bin/bash drivers/hid/spi-hid/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@...el.com>


sparse warnings: (new ones prefixed by >>)
   drivers/hid/spi-hid/spi-hid-apple-core.c:233:21: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le16 [usertype] length @@     got unsigned int @@
   drivers/hid/spi-hid/spi-hid-apple-core.c:233:21: sparse:     expected restricted __le16 [usertype] length
   drivers/hid/spi-hid/spi-hid-apple-core.c:233:21: sparse:     got unsigned int
   drivers/hid/spi-hid/spi-hid-apple-core.c:248:20: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le16 [usertype] crc16 @@     got unsigned short @@
   drivers/hid/spi-hid/spi-hid-apple-core.c:248:20: sparse:     expected restricted __le16 [usertype] crc16
   drivers/hid/spi-hid/spi-hid-apple-core.c:248:20: sparse:     got unsigned short
   drivers/hid/spi-hid/spi-hid-apple-core.c:259:21: sparse: sparse: symbol 'spihid_get_data' was not declared. Should it be static?
   drivers/hid/spi-hid/spi-hid-apple-core.c:639:67: sparse: sparse: incorrect type in argument 5 (different base types) @@     expected unsigned int [usertype] len @@     got restricted __le16 [usertype] length @@
   drivers/hid/spi-hid/spi-hid-apple-core.c:639:67: sparse:     expected unsigned int [usertype] len
   drivers/hid/spi-hid/spi-hid-apple-core.c:639:67: sparse:     got restricted __le16 [usertype] length
   drivers/hid/spi-hid/spi-hid-apple-core.c:643:54: sparse: sparse: incorrect type in argument 4 (different base types) @@     expected unsigned int [usertype] len @@     got restricted __le16 [usertype] length @@
   drivers/hid/spi-hid/spi-hid-apple-core.c:643:54: sparse:     expected unsigned int [usertype] len
   drivers/hid/spi-hid/spi-hid-apple-core.c:643:54: sparse:     got restricted __le16 [usertype] length
   drivers/hid/spi-hid/spi-hid-apple-core.c:665:50: sparse: sparse: incorrect type in argument 6 (different base types) @@     expected unsigned int [usertype] len @@     got restricted __le16 [usertype] length @@
   drivers/hid/spi-hid/spi-hid-apple-core.c:665:50: sparse:     expected unsigned int [usertype] len
   drivers/hid/spi-hid/spi-hid-apple-core.c:665:50: sparse:     got restricted __le16 [usertype] length
   drivers/hid/spi-hid/spi-hid-apple-core.c:686:16: sparse: sparse: restricted __le16 degrades to integer
   drivers/hid/spi-hid/spi-hid-apple-core.c:700:43: sparse: sparse: restricted __le16 degrades to integer
   drivers/hid/spi-hid/spi-hid-apple-core.c:703:23: sparse: sparse: restricted __le16 degrades to integer
   drivers/hid/spi-hid/spi-hid-apple-core.c:704:24: sparse: sparse: restricted __le16 degrades to integer
   drivers/hid/spi-hid/spi-hid-apple-core.c:704:47: sparse: sparse: restricted __le16 degrades to integer
>> drivers/hid/spi-hid/spi-hid-apple-core.c:709:17: sparse: sparse: cast from restricted __le16
   drivers/hid/spi-hid/spi-hid-apple-core.c:709:17: sparse: sparse: restricted __le16 degrades to integer
   drivers/hid/spi-hid/spi-hid-apple-core.c:709:17: sparse: sparse: restricted __le16 degrades to integer
   drivers/hid/spi-hid/spi-hid-apple-core.c:709:17: sparse: sparse: restricted __le16 degrades to integer
   drivers/hid/spi-hid/spi-hid-apple-core.c:710:29: sparse: sparse: invalid assignment: +=
   drivers/hid/spi-hid/spi-hid-apple-core.c:710:29: sparse:    left side has type unsigned int
   drivers/hid/spi-hid/spi-hid-apple-core.c:710:29: sparse:    right side has type restricted __le16
   drivers/hid/spi-hid/spi-hid-apple-core.c:735:23: sparse: sparse: restricted __le16 degrades to integer

vim +709 drivers/hid/spi-hid/spi-hid-apple-core.c

   669	
   670	static void spihid_assemble_meesage(struct spihid_apple *spihid,
   671					    struct spihid_transfer_packet *pkt)
   672	{
   673		size_t length, offset, remain;
   674		struct device *dev = &spihid->spidev->dev;
   675		struct spihid_input_report *rep = &spihid->report;
   676	
   677		length = le16_to_cpu(pkt->length);
   678		remain = le16_to_cpu(pkt->remain);
   679		offset = le16_to_cpu(pkt->offset);
   680	
   681		if (offset + length + remain > U16_MAX) {
   682			return;
   683		}
   684	
   685		if (pkt->device != rep->device || pkt->flags != rep->flags ||
   686		    pkt->offset != rep->offset) {
   687			rep->device = 0;
   688			rep->flags = 0;
   689			rep->offset = 0;
   690			rep->length = 0;
   691		}
   692	
   693		if (pkt->offset == 0) {
   694			if (rep->offset != 0) {
   695				dev_warn(dev, "incomplete report off:%u len:%u",
   696					 rep->offset, rep->length);
   697			}
   698			memcpy(rep->buf, pkt->data, length);
   699			rep->offset = length;
   700			rep->length = length + pkt->remain;
   701			rep->device = pkt->device;
   702			rep->flags = pkt->flags;
   703		} else if (pkt->offset == rep->offset) {
   704			if (pkt->offset + length + pkt->remain != rep->length) {
   705				dev_warn(dev, "incomplete report off:%u len:%u",
   706					 rep->offset, rep->length);
   707				return;
   708			}
 > 709			memcpy(rep->buf + pkt->offset, pkt->data, pkt->length);
   710			rep->offset += pkt->length;
   711	
   712			if (rep->offset == rep->length) {
   713				spihid_process_message(spihid, rep->buf, rep->length,
   714						       rep->device, rep->flags);
   715				rep->device = 0;
   716				rep->flags = 0;
   717				rep->offset = 0;
   718				rep->length = 0;
   719			}
   720		}
   721	}
   722	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ