lkml.org 
[lkml]   [2018]   [Sep]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v6 1/3] x86/boot: Add acpitb.c to parse acpi tables
Hi Chao,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on tip/x86/core]
[also build test WARNING on v4.19-rc3 next-20180911]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Chao-Fan/x86-boot-KASLR-Parse-ACPI-table-and-limit-kaslr-in-immovable-memory/20180911-043350
config: i386-randconfig-x0-09121328 (attached as .config)
compiler: gcc-5 (Debian 5.5.0-3) 5.4.1 20171010
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

All warnings (new ones prefixed by >>):

arch/x86/boot/compressed/acpitb.c: In function 'bios_get_rsdp_addr':
>> arch/x86/boot/compressed/acpitb.c:181:14: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
table_ptr = (u8 *)(acpi_physical_address)address;
^
arch/x86/boot/compressed/acpitb.c: In function 'get_acpi_rsdp':
arch/x86/boot/compressed/acpitb.c:225:3: warning: implicit declaration of function 'error' [-Wimplicit-function-declaration]
error("Failed to allocate space for tmp_cmdline");
^
>> arch/x86/boot/compressed/acpitb.c:237:4: warning: implicit declaration of function 'warn' [-Wimplicit-function-declaration]
warn("Only '--' specified in cmdline");
^
arch/x86/boot/compressed/acpitb.c: In function 'get_acpi_srat_table':
arch/x86/boot/compressed/acpitb.c:296:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
rsdp = (struct acpi_table_rsdp *)get_rsdp_addr();
^
arch/x86/boot/compressed/acpitb.c:311:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
header = (struct acpi_table_header *)root_table;
^
arch/x86/boot/compressed/acpitb.c:328:13: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
header = (struct acpi_table_header *)acpi_table;
^

vim +181 arch/x86/boot/compressed/acpitb.c

164
165 /*
166 * Used to search RSDP physical address.
167 * Based on acpi_find_root_pointer(). Since only use physical address
168 * in this period, so there is no need to do the memory map jobs.
169 */
170 static void bios_get_rsdp_addr(acpi_physical_address *rsdp_addr)
171 {
172 struct acpi_table_rsdp *rsdp;
173 u8 *table_ptr;
174 u8 *mem_rover;
175 u32 address;
176
177 /* Get the location of the Extended BIOS Data Area (EBDA) */
178 table_ptr = (u8 *)ACPI_EBDA_PTR_LOCATION;
179 *(u32 *)(void *)&address = *(u16 *)(void *)table_ptr;
180 address <<= 4;
> 181 table_ptr = (u8 *)(acpi_physical_address)address;
182
183 /*
184 * Search EBDA paragraphs (EBDA is required to be a minimum of
185 * 1K length)
186 */
187 if (address > 0x400) {
188 mem_rover = scan_mem_for_rsdp(table_ptr, ACPI_EBDA_WINDOW_SIZE);
189
190 if (mem_rover) {
191 address += (u32)ACPI_PTR_DIFF(mem_rover, table_ptr);
192 *rsdp_addr = (acpi_physical_address)address;
193 return;
194 }
195 }
196
197 table_ptr = (u8 *)ACPI_HI_RSDP_WINDOW_BASE;
198 mem_rover = scan_mem_for_rsdp(table_ptr, ACPI_HI_RSDP_WINDOW_SIZE);
199
200 /*
201 * Search upper memory: 16-byte boundaries in E0000h-FFFFFh
202 */
203 if (mem_rover) {
204 address = (u32)(ACPI_HI_RSDP_WINDOW_BASE +
205 ACPI_PTR_DIFF(mem_rover, table_ptr));
206 *rsdp_addr = (acpi_physical_address)address;
207 return;
208 }
209 }
210
211 #ifdef CONFIG_KEXEC
212 static bool get_acpi_rsdp(acpi_physical_address *rsdp_addr)
213 {
214 char *args = (char *)get_cmd_line_ptr();
215 size_t len = strlen((char *)args);
216 char *tmp_cmdline, *param, *val;
217 unsigned long long addr = 0;
218 char *endptr;
219
220 if (!strstr(args, "acpi_rsdp="))
221 return false;
222
223 tmp_cmdline = malloc(len+1);
224 if (!tmp_cmdline)
225 error("Failed to allocate space for tmp_cmdline");
226
227 memcpy(tmp_cmdline, args, len);
228 tmp_cmdline[len] = 0;
229 args = tmp_cmdline;
230
231 args = skip_spaces(args);
232
233 while (*args) {
234 args = next_arg(args, &param, &val);
235
236 if (!val && strcmp(param, "--") == 0) {
> 237 warn("Only '--' specified in cmdline");
238 free(tmp_cmdline);
239 return false;
240 }
241
242 if (!strcmp(param, "acpi_rsdp")) {
243 addr = simple_strtoull(val, &endptr, 0);
244
245 if (addr == 0)
246 return false;
247
248 *rsdp_addr = (acpi_physical_address)addr;
249 return true;
250 }
251 }
252 return false;
253 }
254 #else
255 static bool get_acpi_rsdp(acpi_physical_address *rsdp_addr)
256 {
257 return false;
258 }
259 #endif
260

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[unhandled content-type:application/gzip]
\
 
 \ /
  Last update: 2018-09-12 09:10    [W:0.134 / U:1.984 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site