tree:
https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git rdma-next
head: 93f98326fc4e11126c642c8fcdcde78a3988a069
commit: 96d06cee786f3ea1f4a623ed2d88bc77059aa671 [69/78] RDMA/uverbs: Expose the new GID
query API to user space
config: i386-randconfig-m021-20200911 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
New smatch warnings:
drivers/infiniband/core/uverbs_std_types_device.c:353
ib_uverbs_handler_UVERBS_METHOD_QUERY_GID_TABLE() warn: unsigned 'num_entries' is
never less than zero.
Old smatch warnings:
include/rdma/uverbs_ioctl.h:708 uverbs_attr_get_len() warn: passing a valid pointer to
'PTR_ERR'
drivers/infiniband/core/uverbs_std_types_device.c:291 copy_gid_entries_to_user() warn:
passing a valid pointer to 'PTR_ERR'
#
https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git/commi...
git remote add leon-rdma
https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git
git fetch --no-tags leon-rdma rdma-next
git checkout 96d06cee786f3ea1f4a623ed2d88bc77059aa671
vim +/num_entries +353 drivers/infiniband/core/uverbs_std_types_device.c
311
312 static int UVERBS_HANDLER(UVERBS_METHOD_QUERY_GID_TABLE)(
313 struct uverbs_attr_bundle *attrs)
314 {
315 struct ib_uverbs_gid_entry *entries;
316 struct ib_ucontext *ucontext;
317 struct ib_device *ib_dev;
318 size_t user_entry_size;
319 size_t max_entries;
320 size_t num_entries;
321 u32 flags;
322 int ret;
323
324 ret = uverbs_get_flags32(&flags, attrs,
325 UVERBS_ATTR_QUERY_GID_TABLE_FLAGS, 0);
326 if (ret)
327 return ret;
328
329 ret = uverbs_get_const(&user_entry_size, attrs,
330 UVERBS_ATTR_QUERY_GID_TABLE_ENTRY_SIZE);
331 if (ret)
332 return ret;
333
334 max_entries = uverbs_attr_ptr_get_array_size(
335 attrs, UVERBS_ATTR_QUERY_GID_TABLE_RESP_ENTRIES,
336 user_entry_size);
337 if (max_entries <= 0)
338 return -EINVAL;
339
340 ucontext = ib_uverbs_get_ucontext(attrs);
341 if (IS_ERR(ucontext))
342 return PTR_ERR(ucontext);
343 ib_dev = ucontext->device;
344
345 if (check_mul_overflow(max_entries, sizeof(*entries), &num_entries))
346 return -EINVAL;
347
348 entries = uverbs_zalloc(attrs, num_entries);
349 if (!entries)
350 return -ENOMEM;
351
352 num_entries = rdma_query_gid_table(ib_dev, entries, max_entries);
353 if (num_entries < 0)
354 return num_entries;
355
356 ret = copy_gid_entries_to_user(attrs, entries, num_entries,
357 user_entry_size);
358 if (ret)
359 return ret;
360
361 ret = uverbs_copy_to(attrs,
362 UVERBS_ATTR_QUERY_GID_TABLE_RESP_NUM_ENTRIES,
363 &num_entries, sizeof(num_entries));
364 return ret;
365 }
366
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org