From: "tip-bot2 for Dave Hansen" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: kernel test robot <lkp@intel.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
Borislav Petkov <bp@suse.de>, Jarkko Sakkinen <jarkko@kernel.org>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: x86/sgx] x86/sgx: Fix uninitialized 'nid' variable
Date: Fri, 19 Mar 2021 08:57:31 -0000 [thread overview]
Message-ID: <161614425117.398.12898724326370108722.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20210318214933.29341-1-dave.hansen@intel.com>
The following commit has been merged into the x86/sgx branch of tip:
Commit-ID: 262e88b63f55e3d2bacdf629874a0af486775572
Gitweb: https://git.kernel.org/tip/262e88b63f55e3d2bacdf629874a0af486775572
Author: Dave Hansen <dave.hansen@intel.com>
AuthorDate: Thu, 18 Mar 2021 14:49:33 -07:00
Committer: Borislav Petkov <bp@suse.de>
CommitterDate: Fri, 19 Mar 2021 09:51:55 +01:00
x86/sgx: Fix uninitialized 'nid' variable
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>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Link: https://lkml.kernel.org/r/20210318214933.29341-1-dave.hansen@intel.com
---
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 5c9c5e5..13a7599 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);
prev parent reply other threads:[~2021-03-19 8:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-18 21:03 [tip:x86/sgx 2/2] arch/x86/kernel/cpu/sgx/main.c:496:7: warning: variable 'nid' is used uninitialized whenever 'if' condition is false kernel test robot
2021-03-18 21:49 ` [PATCH] x86/sgx: fix uninitialized 'nid' variable Dave Hansen
2021-03-19 5:38 ` Jarkko Sakkinen
2021-03-19 8:57 ` tip-bot2 for Dave Hansen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=161614425117.398.12898724326370108722.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=bp@suse.de \
--cc=dave.hansen@linux.intel.com \
--cc=jarkko@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=lkp@intel.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®