kernel/dma/pool.c:79 cma_in_zone() warn: always true condition '(end <= ((((32) == 64)) << (32)) - 1))) => (0-u32max <= u32max)'

From: kernel test robot
Date: Tue Aug 25 2020 - 01:55:55 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 6a9dc5fd6170d0a41c8a14eb19e63d94bea5705a
commit: d7e673ec2c8e0ea39c4c70fc490d67d7fbda869d dma-pool: Only allocate from CMA when in same memory zone
date: 11 days ago
config: arc-randconfig-m031-20200824 (attached as .config)
compiler: arc-elf-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

New smatch warnings:
kernel/dma/pool.c:79 cma_in_zone() warn: always true condition '(end <= ((((32) == 64)) ?~0:((1 << (32)) - 1))) => (0-u32max <= u32max)'

Old smatch warnings:
arch/arc/include/asm/thread_info.h:65 current_thread_info() error: uninitialized symbol 'sp'.

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d7e673ec2c8e0ea39c4c70fc490d67d7fbda869d
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout d7e673ec2c8e0ea39c4c70fc490d67d7fbda869d
vim +79 kernel/dma/pool.c

59
60 static bool cma_in_zone(gfp_t gfp)
61 {
62 unsigned long size;
63 phys_addr_t end;
64 struct cma *cma;
65
66 cma = dev_get_cma_area(NULL);
67 if (!cma)
68 return false;
69
70 size = cma_get_size(cma);
71 if (!size)
72 return false;
73
74 /* CMA can't cross zone boundaries, see cma_activate_area() */
75 end = cma_get_base(cma) + size - 1;
76 if (IS_ENABLED(CONFIG_ZONE_DMA) && (gfp & GFP_DMA))
77 return end <= DMA_BIT_MASK(zone_dma_bits);
78 if (IS_ENABLED(CONFIG_ZONE_DMA32) && (gfp & GFP_DMA32))
> 79 return end <= DMA_BIT_MASK(32);
80 return true;
81 }
82

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip