* [PATCH] x86/sgx: fix uninitialized 'nid' variable [not found] <202103190514.xH7IrKMe-lkp@intel.com> @ 2021-03-18 21:49 ` Dave Hansen 2021-03-19 5:38 ` Jarkko Sakkinen 0 siblings, 1 reply; 2+ messages in thread From: Dave Hansen @ 2021-03-18 21:49 UTC (permalink / raw) To: linux-kernel Cc: Dave Hansen, Dave Hansen, Jarkko Sakkinen, Borislav Petkov, x86, linux-sgx The NUMA fallback in __sgx_alloc_epc_page() recently grew an additional 'nid' variable to prevent extra trips through the fallback loop in case where the thread is migrated around. But, the new copy is not properly initialized. Fix it. This was found by some fancy clang that 0day runs. My gcc does not detect it. Fixes: 5b8719504e3a ("x86/sgx: Add a basic NUMA allocation scheme to sgx_alloc_epc_page()") Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Cc: Jarkko Sakkinen <jarkko@kernel.org> Cc: Borislav Petkov <bp@alien8.de> Cc: x86@kernel.org Cc: linux-sgx@vger.kernel.org --- arch/x86/kernel/cpu/sgx/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/sgx/main.c b/arch/x86/kernel/cpu/sgx/main.c index 2a0031e4a4dc..1b4d8a0e0915 100644 --- a/arch/x86/kernel/cpu/sgx/main.c +++ b/arch/x86/kernel/cpu/sgx/main.c @@ -489,7 +489,7 @@ struct sgx_epc_page *__sgx_alloc_epc_page(void) { struct sgx_epc_page *page; int nid_of_current = numa_node_id(); - int nid; + int nid = nid_of_current; if (node_isset(nid_of_current, sgx_numa_mask)) { page = __sgx_alloc_epc_page_from_node(nid_of_current); -- 2.19.1 ^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] x86/sgx: fix uninitialized 'nid' variable 2021-03-18 21:49 ` [PATCH] x86/sgx: fix uninitialized 'nid' variable Dave Hansen @ 2021-03-19 5:38 ` Jarkko Sakkinen 0 siblings, 0 replies; 2+ messages in thread From: Jarkko Sakkinen @ 2021-03-19 5:38 UTC (permalink / raw) To: Dave Hansen; +Cc: linux-kernel, Dave Hansen, Borislav Petkov, x86, linux-sgx On Thu, Mar 18, 2021 at 02:49:33PM -0700, Dave Hansen wrote: > The NUMA fallback in __sgx_alloc_epc_page() recently grew an > additional 'nid' variable to prevent extra trips through the > fallback loop in case where the thread is migrated around. > > But, the new copy is not properly initialized. Fix it. > > This was found by some fancy clang that 0day runs. My gcc > does not detect it. > > Fixes: 5b8719504e3a ("x86/sgx: Add a basic NUMA allocation scheme to sgx_alloc_epc_page()") > Reported-by: kernel test robot <lkp@intel.com> > Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> > Cc: Jarkko Sakkinen <jarkko@kernel.org> > Cc: Borislav Petkov <bp@alien8.de> > Cc: x86@kernel.org > Cc: linux-sgx@vger.kernel.org Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> > --- > arch/x86/kernel/cpu/sgx/main.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/kernel/cpu/sgx/main.c b/arch/x86/kernel/cpu/sgx/main.c > index 2a0031e4a4dc..1b4d8a0e0915 100644 > --- a/arch/x86/kernel/cpu/sgx/main.c > +++ b/arch/x86/kernel/cpu/sgx/main.c > @@ -489,7 +489,7 @@ struct sgx_epc_page *__sgx_alloc_epc_page(void) > { > struct sgx_epc_page *page; > int nid_of_current = numa_node_id(); > - int nid; > + int nid = nid_of_current; > > if (node_isset(nid_of_current, sgx_numa_mask)) { > page = __sgx_alloc_epc_page_from_node(nid_of_current); > -- > 2.19.1 > > /Jarkko ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-19 5:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <202103190514.xH7IrKMe-lkp@intel.com>
2021-03-18 21:49 ` [PATCH] x86/sgx: fix uninitialized 'nid' variable Dave Hansen
2021-03-19 5:38 ` Jarkko Sakkinen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox