From: kernel test robot <lkp@intel.com>
To: Rob Clark <robdclark@chromium.org>
Cc: clang-built-linux@googlegroups.com, kbuild-all@lists.01.org,
linux-kernel@vger.kernel.org,
"Kristian H. Kristensen" <hoegsberg@google.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
Date: Sun, 15 Aug 2021 08:45:35 +0800 [thread overview]
Message-ID: <202108150827.rsVrTcnz-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 3632 bytes --]
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@intel.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
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 37624 bytes --]
reply other threads:[~2021-08-15 0:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202108150827.rsVrTcnz-lkp@intel.com \
--to=lkp@intel.com \
--cc=clang-built-linux@googlegroups.com \
--cc=hoegsberg@google.com \
--cc=kbuild-all@lists.01.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robdclark@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®