Skip to contentSkip to conversation

iommu/vt-d: fix constant-out-of-range warning

PATCH New Arnd Bergmann 1 participant 1 message Feb 13, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iommu/vt-d: fix constant-out-of-range warning

From: Arnd Bergmann <[email protected]>

On 32-bit builds, the vt-d driver causes a warning with clang:

drivers/iommu/intel/nested.c:112:13: error: result of comparison of constant 18446744073709551615 with expression of type 'unsigned long' is always false [-Werror,-Wtautological-constant-out-of-range-compare]
112 | if (npages == U64_MAX)

      |             ~~~~~~ ^  ~~~~~~~

This can be easily avoided by making the variable a 64-bit type, which matches both the caller and the use anyway.

Fixes f6f3721244a8 ("iommu/vt-d: Add iotlb flush for nested domain")
---
 drivers/iommu/intel/nested.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/intel/nested.c +1 -1
index f26c7f1c46cc..77a09c982979 100644
@@ -95,7 +95,7 @@ static void nested_flush_dev_iotlb(struct dmar_domain *domain, u64 addr,
 }
 
 static void intel_nested_flush_cache(struct dmar_domain *domain, u64 addr,
-				     unsigned long npages, bool ih)
+				     u64 npages, bool ih)
 {
 	struct iommu_domain_info *info;
 	unsigned int mask;
Signature · 1 line
2.39.2