CC: kbuild-...@lists.01.org
TO: Avihai Horon <avih...@nvidia.com>
CC: Leon Romanovsky <leo...@nvidia.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git 
rdma-next
head:   fb60ce5917ddd769e17552ae421d056c0bb151a5
commit: 320a6a2fef0b62d96bcd8dfb182e91a1e8dc137b [67/76] RDMA/uverbs: Expose 
the new GID query API to user space
:::::: branch date: 25 hours ago
:::::: commit date: 25 hours ago
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 <l...@intel.com>
Reported-by: Dan Carpenter <dan.carpen...@oracle.com>

New smatch warnings:
drivers/infiniband/core/uverbs_std_types_device.c:290 
copy_gid_entries_to_user() warn: passing a valid pointer to 'PTR_ERR'

Old smatch warnings:
include/rdma/uverbs_ioctl.h:708 uverbs_attr_get_len() warn: passing a valid 
pointer to 'PTR_ERR'

# 
https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git/commit/?id=320a6a2fef0b62d96bcd8dfb182e91a1e8dc137b
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 320a6a2fef0b62d96bcd8dfb182e91a1e8dc137b
vim +/PTR_ERR +290 drivers/infiniband/core/uverbs_std_types_device.c

1c8fb1ea5a1dbd Yishai Hadas 2020-06-30  269  
320a6a2fef0b62 Avihai Horon 2020-08-31  270  static int 
copy_gid_entries_to_user(struct uverbs_attr_bundle *attrs,
320a6a2fef0b62 Avihai Horon 2020-08-31  271                                 
struct ib_uverbs_gid_entry *entries,
320a6a2fef0b62 Avihai Horon 2020-08-31  272                                 
size_t num_entries, size_t user_entry_size)
320a6a2fef0b62 Avihai Horon 2020-08-31  273  {
320a6a2fef0b62 Avihai Horon 2020-08-31  274     const struct uverbs_attr *attr;
320a6a2fef0b62 Avihai Horon 2020-08-31  275     void __user *user_entries;
320a6a2fef0b62 Avihai Horon 2020-08-31  276     size_t copy_len;
320a6a2fef0b62 Avihai Horon 2020-08-31  277     int ret;
320a6a2fef0b62 Avihai Horon 2020-08-31  278     int i;
320a6a2fef0b62 Avihai Horon 2020-08-31  279  
320a6a2fef0b62 Avihai Horon 2020-08-31  280     if (user_entry_size == 
sizeof(*entries)) {
320a6a2fef0b62 Avihai Horon 2020-08-31  281             ret = 
uverbs_copy_to(attrs,
320a6a2fef0b62 Avihai Horon 2020-08-31  282                                  
UVERBS_ATTR_QUERY_GID_TABLE_RESP_ENTRIES,
320a6a2fef0b62 Avihai Horon 2020-08-31  283                                  
entries, sizeof(*entries) * num_entries);
320a6a2fef0b62 Avihai Horon 2020-08-31  284             return ret;
320a6a2fef0b62 Avihai Horon 2020-08-31  285     }
320a6a2fef0b62 Avihai Horon 2020-08-31  286  
320a6a2fef0b62 Avihai Horon 2020-08-31  287     copy_len = min_t(size_t, 
user_entry_size, sizeof(*entries));
320a6a2fef0b62 Avihai Horon 2020-08-31  288     attr = uverbs_attr_get(attrs, 
UVERBS_ATTR_QUERY_GID_TABLE_RESP_ENTRIES);
320a6a2fef0b62 Avihai Horon 2020-08-31  289     if (IS_ERR(attr))
320a6a2fef0b62 Avihai Horon 2020-08-31 @290             return PTR_ERR(attr);
320a6a2fef0b62 Avihai Horon 2020-08-31  291  
320a6a2fef0b62 Avihai Horon 2020-08-31  292     user_entries = 
u64_to_user_ptr(attr->ptr_attr.data);
320a6a2fef0b62 Avihai Horon 2020-08-31  293     for (i = 0; i < num_entries; 
i++) {
320a6a2fef0b62 Avihai Horon 2020-08-31  294             if 
(copy_to_user(user_entries, entries, copy_len))
320a6a2fef0b62 Avihai Horon 2020-08-31  295                     return -EFAULT;
320a6a2fef0b62 Avihai Horon 2020-08-31  296  
320a6a2fef0b62 Avihai Horon 2020-08-31  297             if (user_entry_size > 
sizeof(*entries)) {
320a6a2fef0b62 Avihai Horon 2020-08-31  298                     if 
(clear_user(user_entries + sizeof(*entries),
320a6a2fef0b62 Avihai Horon 2020-08-31  299                                    
user_entry_size - sizeof(*entries)))
320a6a2fef0b62 Avihai Horon 2020-08-31  300                             return 
-EFAULT;
320a6a2fef0b62 Avihai Horon 2020-08-31  301             }
320a6a2fef0b62 Avihai Horon 2020-08-31  302  
320a6a2fef0b62 Avihai Horon 2020-08-31  303             entries++;
320a6a2fef0b62 Avihai Horon 2020-08-31  304             user_entries += 
user_entry_size;
320a6a2fef0b62 Avihai Horon 2020-08-31  305     }
320a6a2fef0b62 Avihai Horon 2020-08-31  306  
320a6a2fef0b62 Avihai Horon 2020-08-31  307     return 
uverbs_output_written(attrs,
320a6a2fef0b62 Avihai Horon 2020-08-31  308                                  
UVERBS_ATTR_QUERY_GID_TABLE_RESP_ENTRIES);
320a6a2fef0b62 Avihai Horon 2020-08-31  309  }
320a6a2fef0b62 Avihai Horon 2020-08-31  310  

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

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- kbuild@lists.01.org
To unsubscribe send an email to kbuild-le...@lists.01.org

Reply via email to