[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202111180118.WWAWlAvu-lkp@intel.com>
Date: Thu, 18 Nov 2021 01:16:24 +0800
From: kernel test robot <lkp@...el.com>
To: Jason Gunthorpe <jgg@...dia.com>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: [jgunthorpe:iommufd 2/8]
drivers/iommu/iommufd/io_pagetable.c:1212:5: warning: no previous prototype
for 'iopt_access_pages'
tree: https://github.com/jgunthorpe/linux iommufd
head: 4d06b5807e799e0293171d872d8c1a40f3b466c5
commit: 60716d1561f09cff04bd92ceb6007cc04d309469 [2/8] iommufd: Data structure to provide IOVA to PFN mapping
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 11.2.0
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://github.com/jgunthorpe/linux/commit/60716d1561f09cff04bd92ceb6007cc04d309469
git remote add jgunthorpe https://github.com/jgunthorpe/linux
git fetch --no-tags jgunthorpe iommufd
git checkout 60716d1561f09cff04bd92ceb6007cc04d309469
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arc
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/iommu/iommufd/io_pagetable.c:1212:5: warning: no previous prototype for 'iopt_access_pages' [-Wmissing-prototypes]
1212 | int iopt_access_pages(struct io_pagetable *iopt, unsigned long iova,
| ^~~~~~~~~~~~~~~~~
In file included from include/linux/mm.h:30,
from drivers/iommu/iommufd/io_pagetable.c:28:
drivers/iommu/iommufd/io_pagetable.c: In function 'iopt_access_pages':
>> include/linux/overflow.h:84:22: warning: comparison of distinct pointer types lacks a cast
84 | (void) (&__a == &__b); \
| ^~
drivers/iommu/iommufd/io_pagetable.c:1224:13: note: in expansion of macro 'check_mul_overflow'
1224 | if (check_mul_overflow(npages, PAGE_SIZE, &length) ||
| ^~~~~~~~~~~~~~~~~~
include/linux/overflow.h:66:22: warning: comparison of distinct pointer types lacks a cast
66 | (void) (&__a == &__b); \
| ^~
drivers/iommu/iommufd/io_pagetable.c:1225:13: note: in expansion of macro 'check_add_overflow'
1225 | check_add_overflow(iova, length - 1, &iova_end))
| ^~~~~~~~~~~~~~~~~~
drivers/iommu/iommufd/io_pagetable.c: In function 'iopt_unaccess_pages':
>> include/linux/overflow.h:84:22: warning: comparison of distinct pointer types lacks a cast
84 | (void) (&__a == &__b); \
| ^~
drivers/iommu/iommufd/io_pagetable.c:1280:13: note: in expansion of macro 'check_mul_overflow'
1280 | if (check_mul_overflow(npages, PAGE_SIZE, &length) ||
| ^~~~~~~~~~~~~~~~~~
include/linux/overflow.h:66:22: warning: comparison of distinct pointer types lacks a cast
66 | (void) (&__a == &__b); \
| ^~
drivers/iommu/iommufd/io_pagetable.c:1281:13: note: in expansion of macro 'check_add_overflow'
1281 | check_add_overflow(iova, length - 1, &iova_end))
| ^~~~~~~~~~~~~~~~~~
vim +/iopt_access_pages +1212 drivers/iommu/iommufd/io_pagetable.c
1200
1201 /**
1202 * iopt_access_pages - Return a list of pages under the iova
1203 *
1204 * Reads @npages starting at iova and returns the struct page * pointers. These
1205 * can be kmap'd by the caller for CPU access.
1206 *
1207 * The caller must perform iopt_unaccess_pages() when done to balance this.
1208 *
1209 * CHECKME: callers that need a DMA mapping via a sgl should create another
1210 * interface to build the SGL efficiently)
1211 */
> 1212 int iopt_access_pages(struct io_pagetable *iopt, unsigned long iova,
1213 size_t npages, struct page **out_pages, bool write)
1214 {
1215 unsigned long cur_iova;
1216 unsigned long iova_end;
1217 struct iopt_area *area;
1218 size_t length;
1219 int rc;
1220
1221 down_read(&iopt->rwsem);
1222 if (!npages || iova % PAGE_SIZE)
1223 return -EINVAL;
1224 if (check_mul_overflow(npages, PAGE_SIZE, &length) ||
1225 check_add_overflow(iova, length - 1, &iova_end))
1226 return -EOVERFLOW;
1227
1228 cur_iova = iova;
1229 for (area = iopt_area_iter_first(iopt, iova, iova_end); area;
1230 area = iopt_area_iter_next(area, iova, iova_end)) {
1231 unsigned long intr_start = max(iova, iopt_area_iova(area));
1232 unsigned long intr_end =
1233 min(iova_end, iopt_area_last_iova(area));
1234 size_t npages = (intr_end - intr_start + 1) / PAGE_SIZE;
1235
1236 /* Need contiguous areas un the access */
1237 if (cur_iova != intr_start) {
1238 rc = -EINVAL;
1239 goto out_remove;
1240 }
1241
1242 npages = (intr_end - intr_start + 1) / PAGE_SIZE;
1243 rc = iopt_pages_add_user(
1244 area->pages,
1245 (intr_start - iopt_area_iova(area)) / PAGE_SIZE, npages,
1246 out_pages + (intr_end - iopt_area_iova(area) + 1) /
1247 PAGE_SIZE,
1248 write);
1249 if (rc)
1250 goto out_remove;
1251 cur_iova += npages * PAGE_SIZE;
1252 atomic_inc(&area->num_users);
1253 }
1254
1255 up_read(&iopt->rwsem);
1256 return 0;
1257
1258 out_remove:
1259 iopt_unaccess_pages(iopt, iova, (cur_iova - iova) / PAGE_SIZE);
1260 return rc;
1261 }
1262
---
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" (70101 bytes)
Powered by blists - more mailing lists