* [PATCH] dma-pool: turn the end variable in cma_in_zone into a u64
@ 2020-08-27 7:28 Christoph Hellwig
0 siblings, 0 replies; only message in thread
From: Christoph Hellwig @ 2020-08-27 7:28 UTC (permalink / raw)
To: nsaenzjulienne; +Cc: iommu, kernel test robot, dan.carpenter
phys_addr_t can be 32-bit, in which case smatch will complain:
kernel/dma/pool.c:79 cma_in_zone() warn: always true condition '(end <= ((((32) == 64)) ?~0:((1 << (32)) - 1))) => (0-u32max <= u32max)'
Just turn the variable into a u64 to make the range check valid.
Fixes: d7e673ec2c8e ("dma-pool: Only allocate from CMA when in same memory zone")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
kernel/dma/pool.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/dma/pool.c b/kernel/dma/pool.c
index 1281c0f0442bc5..b59325bad8edda 100644
--- a/kernel/dma/pool.c
+++ b/kernel/dma/pool.c
@@ -60,7 +60,7 @@ static void dma_atomic_pool_size_add(gfp_t gfp, size_t size)
static bool cma_in_zone(gfp_t gfp)
{
unsigned long size;
- phys_addr_t end;
+ u64 end;
struct cma *cma;
cma = dev_get_cma_area(NULL);
--
2.28.0
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2020-08-27 7:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-27 7:28 [PATCH] dma-pool: turn the end variable in cma_in_zone into a u64 Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).