Skip to content

Commit

Permalink
x86/sev: Fix address space sparse warning
Browse files Browse the repository at this point in the history
Fix:

  arch/x86/kernel/sev.c:605:16: warning: incorrect type in assignment (different address spaces)
  arch/x86/kernel/sev.c:605:16:    expected struct snp_secrets_page_layout *layout
  arch/x86/kernel/sev.c:605:16:    got void [noderef] __iomem *[assigned] mem

Reported-by: kernel test robot <[email protected]>
Signed-off-by: Borislav Petkov <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
  • Loading branch information
suryasaimadhu committed May 2, 2022
1 parent c2106a2 commit ab65f49
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions arch/x86/kernel/sev.c
Original file line number Diff line number Diff line change
Expand Up @@ -589,20 +589,23 @@ static u64 __init get_secrets_page(void)
static u64 __init get_snp_jump_table_addr(void)
{
struct snp_secrets_page_layout *layout;
void __iomem *mem;
u64 pa, addr;

pa = get_secrets_page();
if (!pa)
return 0;

layout = (__force void *)ioremap_encrypted(pa, PAGE_SIZE);
if (!layout) {
mem = ioremap_encrypted(pa, PAGE_SIZE);
if (!mem) {
pr_err("Unable to locate AP jump table address: failed to map the SNP secrets page.\n");
return 0;
}

layout = (__force struct snp_secrets_page_layout *)mem;

addr = layout->os_area.ap_jump_table_pa;
iounmap(layout);
iounmap(mem);

return addr;
}
Expand Down

0 comments on commit ab65f49

Please sign in to comment.