[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YmBRW6xMhNiW7JRU@zn.tnic>
Date: Wed, 20 Apr 2022 20:30:51 +0200
From: Borislav Petkov <bp@...en8.de>
To: Michael Roth <michael.roth@....com>
Cc: linux-kernel@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H . Peter Anvin" <hpa@...or.com>,
Kees Cook <keescook@...omium.org>,
"Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>,
Tony Luck <tony.luck@...el.com>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Kuppuswamy Sathyanarayanan
<sathyanarayanan.kuppuswamy@...ux.intel.com>,
Tom Lendacky <thomas.lendacky@....com>,
Venu Busireddy <venu.busireddy@...cle.com>,
Joerg Roedel <jroedel@...e.de>,
Tianyu Lan <Tianyu.Lan@...rosoft.com>,
Brijesh Singh <brijesh.singh@....com>
Subject: Re: [PATCH] x86/sev: get the AP jump table address from secrets page
On Wed, Apr 20, 2022 at 10:27:51AM -0500, Michael Roth wrote:
> +static u64 get_secrets_page(void)
> +{
> + u64 pa_data = boot_params.cc_blob_address;
> + struct cc_blob_sev_info info;
> + void *map;
> +
> + /*
> + * The CC blob contains the address of the secrets page, check if the
> + * blob is present.
> + */
> + if (!pa_data)
> + return 0;
> +
> + map = early_memremap(pa_data, sizeof(info));
That function can return NULL so you need to handle it.
> + memcpy(&info, map, sizeof(info));
> + early_memunmap(map, sizeof(info));
> +
> + /* smoke-test the secrets page passed */
> + if (!info.secrets_phys || info.secrets_len != PAGE_SIZE)
> + return 0;
> +
> + return info.secrets_phys;
> +}
> +
> +static u64 get_snp_jump_table_addr(void)
> +{
> + struct snp_secrets_page_layout *layout;
> + u64 pa = get_secrets_page();
> + u64 addr;
Please don't hide the function call in the local variables declaration
but do this instead:
struct snp_secrets_page_layout *layout;
u64 pa, addr;
pa = get_secrets_page();
if (!pa)
return 0;
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists