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>] [thread-next>] [day] [month] [year] [list]
Message-ID: <202208141119.RKGSGoZ7-lkp@intel.com>
Date:   Mon, 15 Aug 2022 11:07:12 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     kbuild@...ts.01.org, Matthias Kaehlcke <mka@...omium.org>
Cc:     lkp@...el.com, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org, Kees Cook <keescook@...omium.org>
Subject: security/loadpin/loadpin.c:365 dm_verity_ioctl() warn: maybe return
 -EFAULT instead of the bytes remaining?

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   aea23e7c464bfdec04b52cf61edb62030e9e0d0a
commit: 3f805f8cc23ba35679dd01446929292911c2b469 LoadPin: Enable loading from trusted dm-verity devices
config: s390-randconfig-m031-20220810 (https://download.01.org/0day-ci/archive/20220814/202208141119.RKGSGoZ7-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 12.1.0

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

smatch warnings:
security/loadpin/loadpin.c:365 dm_verity_ioctl() warn: maybe return -EFAULT instead of the bytes remaining?

vim +365 security/loadpin/loadpin.c

3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  355  static long dm_verity_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  356  {
3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  357  	void __user *uarg = (void __user *)arg;
3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  358  	unsigned int fd;
3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  359  	int rc;
3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  360  
3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  361  	switch (cmd) {
3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  362  	case LOADPIN_IOC_SET_TRUSTED_VERITY_DIGESTS:
3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  363  		rc = copy_from_user(&fd, uarg, sizeof(fd));
3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  364  		if (rc)
3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27 @365  			return rc;

The copy_from_user() function returns the number of bytes remaining to
be copied.  It should be:

	if (copy_from_user(&fd, uarg, sizeof(fd)))
		return -EFAULT;

3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  366  
3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  367  		return read_trusted_verity_root_digests(fd);
3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  368  
3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  369  	default:
3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  370  		return -EINVAL;
3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  371  	}
3f805f8cc23ba3 Matthias Kaehlcke 2022-06-27  372  }

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ