Commit 2568e71d authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Jason Zeng
Browse files

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

mainline inclusion
from mainline-v6.8-rc6
commit 4578f989ed6b77c14af86bb882cc5ff0a46a69eb
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I938E2
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4578f989ed6b77c14af86bb882cc5ff0a46a69eb



--------------------------------

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)
      |             ~~~~~~ ^  ~~~~~~~

Make 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")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20240213095832.455245-1-arnd@kernel.org


Signed-off-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
Signed-off-by: default avatarJason Zeng <jason.zeng@intel.com>
parent d58f97e3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -103,7 +103,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;