Re: [PATCH] iommu/vt-d: Fix shift overflow in qi_flush_dev_iotlb

From: kbuild test robot
Date: Thu Dec 14 2017 - 22:13:35 EST


Hi Alex,

I love your patch! Yet something to improve:

[auto build test ERROR on v4.15-rc3]
[also build test ERROR on next-20171214]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Alex-Williamson/iommu-vt-d-Fix-shift-overflow-in-qi_flush_dev_iotlb/20171215-094227
config: x86_64-randconfig-x000-201750 (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All error/warnings (new ones prefixed by >>):

In file included from include/linux/string.h:6:0,
from include/uapi/linux/uuid.h:22,
from include/linux/uuid.h:19,
from include/linux/mod_devicetable.h:13,
from include/linux/pci.h:21,
from drivers//iommu/dmar.c:31:
drivers//iommu/dmar.c: In function 'qi_flush_dev_iotlb':
>> drivers//iommu/dmar.c:1348:18: error: 'MAX_AGAW_PFN_WIDTH' undeclared (first use in this function)
BUG_ON((mask > MAX_AGAW_PFN_WIDTH) ||
^
include/linux/compiler.h:77:42: note: in definition of macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
>> drivers//iommu/dmar.c:1348:3: note: in expansion of macro 'BUG_ON'
BUG_ON((mask > MAX_AGAW_PFN_WIDTH) ||
^~~~~~
drivers//iommu/dmar.c:1348:18: note: each undeclared identifier is reported only once for each function it appears in
BUG_ON((mask > MAX_AGAW_PFN_WIDTH) ||
^
include/linux/compiler.h:77:42: note: in definition of macro 'unlikely'
# define unlikely(x) __builtin_expect(!!(x), 0)
^
>> drivers//iommu/dmar.c:1348:3: note: in expansion of macro 'BUG_ON'
BUG_ON((mask > MAX_AGAW_PFN_WIDTH) ||
^~~~~~

vim +/MAX_AGAW_PFN_WIDTH +1348 drivers//iommu/dmar.c

1341
1342 void qi_flush_dev_iotlb(struct intel_iommu *iommu, u16 sid, u16 qdep,
1343 u64 addr, unsigned mask)
1344 {
1345 struct qi_desc desc;
1346
1347 if (mask) {
> 1348 BUG_ON((mask > MAX_AGAW_PFN_WIDTH) ||
1349 ((mask == MAX_AGAW_PFN_WIDTH) && addr) ||
1350 (addr & ((1 << (VTD_PAGE_SHIFT + mask)) - 1)));
1351 addr |= (1ULL << (VTD_PAGE_SHIFT + mask - 1)) - 1;
1352 desc.high = QI_DEV_IOTLB_ADDR(addr) | QI_DEV_IOTLB_SIZE;
1353 } else
1354 desc.high = QI_DEV_IOTLB_ADDR(addr);
1355
1356 if (qdep >= QI_DEV_IOTLB_MAX_INVS)
1357 qdep = 0;
1358
1359 desc.low = QI_DEV_IOTLB_SID(sid) | QI_DEV_IOTLB_QDEP(qdep) |
1360 QI_DIOTLB_TYPE;
1361
1362 qi_submit_sync(&desc, iommu);
1363 }
1364

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip