Re: [PATCH v2] of: address: Add kunit test for __of_address_resource_bounds()

From: kernel test robot
Date: Mon Jan 27 2025 - 06:16:04 EST


Hi Thomas,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 15e2f65f2ecfeb8e39315522e2b5cfdc5651fc10]

url: https://github.com/intel-lab-lkp/linux/commits/Thomas-Wei-schuh/of-address-Add-kunit-test-for-__of_address_resource_bounds/20250127-165902
base: 15e2f65f2ecfeb8e39315522e2b5cfdc5651fc10
patch link: https://lore.kernel.org/r/20250127-of-address-overflow-v2-1-61b5046044e9%40linutronix.de
patch subject: [PATCH v2] of: address: Add kunit test for __of_address_resource_bounds()
config: hexagon-randconfig-001-20250127 (https://download.01.org/0day-ci/archive/20250127/202501271803.wd0vg8zR-lkp@xxxxxxxxx/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250127/202501271803.wd0vg8zR-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202501271803.wd0vg8zR-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> drivers/of/of_test.c:140:42: warning: implicit conversion from 'long long' to 'resource_size_t' (aka 'unsigned int') changes value from 4294971390 to 4094 [-Wconstant-conversion]
135 | {
| ~
136 | .start = 0x1000,
137 | .size = 0xffffffff,
138 | .ret = resource_size_32bit() ? -EOVERFLOW : 0,
139 | .res_start = 0x1000,
140 | .res_end = resource_size_32bit() ? 0 : 0x100000ffe,
| ^~~~~~~~~~~
drivers/of/of_test.c:133:42: warning: implicit conversion from 'long long' to 'resource_size_t' (aka 'unsigned int') changes value from 4294967296 to 0 [-Wconstant-conversion]
128 | {
| ~
129 | .start = 0x100000000ULL,
130 | .size = 1,
131 | .ret = resource_size_32bit() ? -EOVERFLOW : 0,
132 | .res_start = resource_size_32bit() ? 0 : 0x100000000,
133 | .res_end = resource_size_32bit() ? 0 : 0x100000000,
| ^~~~~~~~~~~
drivers/of/of_test.c:132:44: warning: implicit conversion from 'long long' to 'resource_size_t' (aka 'unsigned int') changes value from 4294967296 to 0 [-Wconstant-conversion]
128 | {
| ~
129 | .start = 0x100000000ULL,
130 | .size = 1,
131 | .ret = resource_size_32bit() ? -EOVERFLOW : 0,
132 | .res_start = resource_size_32bit() ? 0 : 0x100000000,
| ^~~~~~~~~~~
3 warnings generated.


vim +140 drivers/of/of_test.c

74
75 static const struct of_address_resource_bounds_case of_address_resource_bounds_cases[] = {
76 {
77 .start = 0,
78 .size = 0,
79 .ret = 0,
80 .res_start = 0,
81 .res_end = -1,
82 },
83 {
84 .start = 0,
85 .size = 0x1000,
86 .ret = 0,
87 .res_start = 0,
88 .res_end = 0xfff,
89 },
90 {
91 .start = 0x1000,
92 .size = 0,
93 .ret = 0,
94 .res_start = 0x1000,
95 .res_end = 0xfff,
96 },
97 {
98 .start = 0x1000,
99 .size = 0x1000,
100 .ret = 0,
101 .res_start = 0x1000,
102 .res_end = 0x1fff,
103 },
104 {
105 .start = 1,
106 .size = RESOURCE_SIZE_MAX,
107 .ret = 0,
108 .res_start = 1,
109 .res_end = RESOURCE_SIZE_MAX,
110 },
111 {
112 .start = RESOURCE_SIZE_MAX,
113 .size = 1,
114 .ret = 0,
115 .res_start = RESOURCE_SIZE_MAX,
116 .res_end = RESOURCE_SIZE_MAX,
117 },
118 {
119 .start = 2,
120 .size = RESOURCE_SIZE_MAX,
121 .ret = -EOVERFLOW,
122 },
123 {
124 .start = RESOURCE_SIZE_MAX,
125 .size = 2,
126 .ret = -EOVERFLOW,
127 },
128 {
129 .start = 0x100000000ULL,
130 .size = 1,
131 .ret = resource_size_32bit() ? -EOVERFLOW : 0,
132 .res_start = resource_size_32bit() ? 0 : 0x100000000,
133 .res_end = resource_size_32bit() ? 0 : 0x100000000,
134 },
135 {
136 .start = 0x1000,
137 .size = 0xffffffff,
138 .ret = resource_size_32bit() ? -EOVERFLOW : 0,
139 .res_start = 0x1000,
> 140 .res_end = resource_size_32bit() ? 0 : 0x100000ffe,
141 },
142 };
143

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki