Skip to content

Commit

Permalink
x86/boot: Fix -Wint-to-pointer-cast build warning
Browse files Browse the repository at this point in the history
Fix this warning when building 32-bit with

CONFIG_RANDOMIZE_BASE=y
CONFIG_MEMORY_HOTREMOVE=y

  arch/x86/boot/compressed/acpi.c:316:9: warning: \
    cast to pointer from integer of different size [-Wint-to-pointer-cast]

Have get_cmdline_acpi_rsdp() return unsigned long which is the proper
type to convert to a pointer of the respective width.

 [ bp: Rewrite commit message, touch ups. ]

Signed-off-by: Vamshi K Sthambamkadi <vamshi.k.sthambamkadi@gmail.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lkml.kernel.org/r/1587645588-7130-3-git-send-email-vamshi.k.sthambamkadi@gmail.com
  • Loading branch information
Vamshi K Sthambamkadi authored and Borislav Petkov committed May 4, 2020
1 parent 5fafbeb commit 40ba930
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions arch/x86/boot/compressed/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,9 @@ acpi_physical_address get_rsdp_addr(void)
*/
#define MAX_ADDR_LEN 19

static acpi_physical_address get_cmdline_acpi_rsdp(void)
static unsigned long get_cmdline_acpi_rsdp(void)
{
acpi_physical_address addr = 0;
unsigned long addr = 0;

#ifdef CONFIG_KEXEC
char val[MAX_ADDR_LEN] = { };
Expand All @@ -292,7 +292,7 @@ static acpi_physical_address get_cmdline_acpi_rsdp(void)
if (ret < 0)
return 0;

if (kstrtoull(val, 16, &addr))
if (boot_kstrtoul(val, 16, &addr))
return 0;
#endif
return addr;
Expand All @@ -314,7 +314,6 @@ static unsigned long get_acpi_srat_table(void)
* different ideas about whether to trust a command-line parameter.
*/
rsdp = (struct acpi_table_rsdp *)get_cmdline_acpi_rsdp();

if (!rsdp)
rsdp = (struct acpi_table_rsdp *)(long)
boot_params->acpi_rsdp_addr;
Expand Down

0 comments on commit 40ba930

Please sign in to comment.