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]
Date:   Sun, 15 Aug 2021 08:45:35 +0800
From:   kernel test robot <lkp@...el.com>
To:     Rob Clark <robdclark@...omium.org>
Cc:     clang-built-linux@...glegroups.com, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org,
        "Kristian H. Kristensen" <hoegsberg@...gle.com>
Subject: drivers/gpu/drm/msm/msm_gem_submit.c:202:10: warning: result of
 comparison of constant 18446744073709551615 with expression of type
 'unsigned int' is always false

Hi Rob,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   ba31f97d43be41ca99ab72a6131d7c226306865f
commit: 20224d715a882210428ea62bba93f1bc4a0afe23 drm/msm/submit: Move copy_from_user ahead of locking bos
date:   9 months ago
config: arm64-buildonly-randconfig-r006-20210815 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 1f7b25ea76a925aca690da28de9d78db7ca99d0c)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=20224d715a882210428ea62bba93f1bc4a0afe23
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 20224d715a882210428ea62bba93f1bc4a0afe23
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 

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

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/msm/msm_gem_submit.c:202:10: warning: result of comparison of constant 18446744073709551615 with expression of type 'unsigned int' is always false [-Wtautological-constant-out-of-range-compare]
                   if (sz == SIZE_MAX) {
                       ~~ ^  ~~~~~~~~
   1 warning generated.


vim +202 drivers/gpu/drm/msm/msm_gem_submit.c

   157	
   158	static int submit_lookup_cmds(struct msm_gem_submit *submit,
   159			struct drm_msm_gem_submit *args, struct drm_file *file)
   160	{
   161		unsigned i, sz;
   162		int ret = 0;
   163	
   164		for (i = 0; i < args->nr_cmds; i++) {
   165			struct drm_msm_gem_submit_cmd submit_cmd;
   166			void __user *userptr =
   167				u64_to_user_ptr(args->cmds + (i * sizeof(submit_cmd)));
   168	
   169			ret = copy_from_user(&submit_cmd, userptr, sizeof(submit_cmd));
   170			if (ret) {
   171				ret = -EFAULT;
   172				goto out;
   173			}
   174	
   175			/* validate input from userspace: */
   176			switch (submit_cmd.type) {
   177			case MSM_SUBMIT_CMD_BUF:
   178			case MSM_SUBMIT_CMD_IB_TARGET_BUF:
   179			case MSM_SUBMIT_CMD_CTX_RESTORE_BUF:
   180				break;
   181			default:
   182				DRM_ERROR("invalid type: %08x\n", submit_cmd.type);
   183				return -EINVAL;
   184			}
   185	
   186			if (submit_cmd.size % 4) {
   187				DRM_ERROR("non-aligned cmdstream buffer size: %u\n",
   188						submit_cmd.size);
   189				ret = -EINVAL;
   190				goto out;
   191			}
   192	
   193			submit->cmd[i].type = submit_cmd.type;
   194			submit->cmd[i].size = submit_cmd.size / 4;
   195			submit->cmd[i].offset = submit_cmd.submit_offset / 4;
   196			submit->cmd[i].idx  = submit_cmd.submit_idx;
   197			submit->cmd[i].nr_relocs = submit_cmd.nr_relocs;
   198	
   199			sz = array_size(submit_cmd.nr_relocs,
   200					sizeof(struct drm_msm_gem_submit_reloc));
   201			/* check for overflow: */
 > 202			if (sz == SIZE_MAX) {
   203				ret = -ENOMEM;
   204				goto out;
   205			}
   206			submit->cmd[i].relocs = kmalloc(sz, GFP_KERNEL);
   207			ret = copy_from_user(submit->cmd[i].relocs, userptr, sz);
   208			if (ret) {
   209				ret = -EFAULT;
   210				goto out;
   211			}
   212		}
   213	
   214	out:
   215		return ret;
   216	}
   217	

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

Download attachment ".config.gz" of type "application/gzip" (37624 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ