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

From: kernel test robot
Date: Sun Jan 26 2025 - 05:00:26 EST


Hi Thomas,

kernel test robot noticed the following build warnings:

[auto build test WARNING on ffd294d346d185b70e28b1a28abe367bbfe53c04]

url: https://github.com/intel-lab-lkp/linux/commits/Thomas-Wei-schuh/of-address-Fix-empty-resource-handling-in-__of_address_resource_bounds/20250120-221141
base: ffd294d346d185b70e28b1a28abe367bbfe53c04
patch link: https://lore.kernel.org/r/20250120-of-address-overflow-v1-2-dd68dbf47bce%40linutronix.de
patch subject: [PATCH 2/2] of: address: Add kunit test for __of_address_resource_bounds()
config: arc-randconfig-r121-20250126 (https://download.01.org/0day-ci/archive/20250126/202501261727.x0aztept-lkp@xxxxxxxxx/config)
compiler: arceb-elf-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20250126/202501261727.x0aztept-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/202501261727.x0aztept-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> drivers/of/of_test.c:130:47: sparse: sparse: cast truncates bits from constant value (100000000 becomes 0)
drivers/of/of_test.c:131:45: sparse: sparse: cast truncates bits from constant value (100000000 becomes 0)
>> drivers/of/of_test.c:138:45: sparse: sparse: cast truncates bits from constant value (100000ffe becomes ffe)

vim +130 drivers/of/of_test.c

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

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