From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [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
Date: Fri, 19 Mar 2021 05:03:21 +0800 [thread overview]
Message-ID: <202103190514.xH7IrKMe-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 6355 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/sgx
head: 5b8719504e3adf47646273781591ad439b3c3c7a
commit: 5b8719504e3adf47646273781591ad439b3c3c7a [2/2] x86/sgx: Add a basic NUMA allocation scheme to sgx_alloc_epc_page()
config: x86_64-randconfig-r004-20210318 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 6db3ab2903f42712f44000afb5aa467efbd25f35)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=5b8719504e3adf47646273781591ad439b3c3c7a
git remote add tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
git fetch --no-tags tip x86/sgx
git checkout 5b8719504e3adf47646273781591ad439b3c3c7a
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> arch/x86/kernel/cpu/sgx/main.c:496:7: warning: variable 'nid' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (page)
^~~~
arch/x86/kernel/cpu/sgx/main.c:502:22: note: uninitialized use occurs here
nid = next_node_in(nid, sgx_numa_mask);
^~~
include/linux/nodemask.h:278:46: note: expanded from macro 'next_node_in'
#define next_node_in(n, src) __next_node_in((n), &(src))
^
arch/x86/kernel/cpu/sgx/main.c:496:3: note: remove the 'if' if its condition is always true
if (page)
^~~~~~~~~
arch/x86/kernel/cpu/sgx/main.c:494:6: warning: variable 'nid' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (node_isset(nid_of_current, sgx_numa_mask)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/nodemask.h:152:36: note: expanded from macro 'node_isset'
#define node_isset(node, nodemask) test_bit((node), (nodemask).bits)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/kernel/cpu/sgx/main.c:502:22: note: uninitialized use occurs here
nid = next_node_in(nid, sgx_numa_mask);
^~~
include/linux/nodemask.h:278:46: note: expanded from macro 'next_node_in'
#define next_node_in(n, src) __next_node_in((n), &(src))
^
arch/x86/kernel/cpu/sgx/main.c:494:2: note: remove the 'if' if its condition is always true
if (node_isset(nid_of_current, sgx_numa_mask)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/kernel/cpu/sgx/main.c:492:9: note: initialize the variable 'nid' to silence this warning
int nid;
^
= 0
2 warnings generated.
vim +496 arch/x86/kernel/cpu/sgx/main.c
d2285493bef310 Jarkko Sakkinen 2020-11-13 477
d2285493bef310 Jarkko Sakkinen 2020-11-13 478 /**
d2285493bef310 Jarkko Sakkinen 2020-11-13 479 * __sgx_alloc_epc_page() - Allocate an EPC page
d2285493bef310 Jarkko Sakkinen 2020-11-13 480 *
5b8719504e3adf Jarkko Sakkinen 2021-03-18 481 * Iterate through NUMA nodes and reserve ia free EPC page to the caller. Start
5b8719504e3adf Jarkko Sakkinen 2021-03-18 482 * from the NUMA node, where the caller is executing.
d2285493bef310 Jarkko Sakkinen 2020-11-13 483 *
d2285493bef310 Jarkko Sakkinen 2020-11-13 484 * Return:
5b8719504e3adf Jarkko Sakkinen 2021-03-18 485 * - an EPC page: A borrowed EPC pages were available.
5b8719504e3adf Jarkko Sakkinen 2021-03-18 486 * - NULL: Out of EPC pages.
d2285493bef310 Jarkko Sakkinen 2020-11-13 487 */
d2285493bef310 Jarkko Sakkinen 2020-11-13 488 struct sgx_epc_page *__sgx_alloc_epc_page(void)
d2285493bef310 Jarkko Sakkinen 2020-11-13 489 {
d2285493bef310 Jarkko Sakkinen 2020-11-13 490 struct sgx_epc_page *page;
5b8719504e3adf Jarkko Sakkinen 2021-03-18 491 int nid_of_current = numa_node_id();
5b8719504e3adf Jarkko Sakkinen 2021-03-18 492 int nid;
d2285493bef310 Jarkko Sakkinen 2020-11-13 493
5b8719504e3adf Jarkko Sakkinen 2021-03-18 494 if (node_isset(nid_of_current, sgx_numa_mask)) {
5b8719504e3adf Jarkko Sakkinen 2021-03-18 495 page = __sgx_alloc_epc_page_from_node(nid_of_current);
d2285493bef310 Jarkko Sakkinen 2020-11-13 @496 if (page)
d2285493bef310 Jarkko Sakkinen 2020-11-13 497 return page;
d2285493bef310 Jarkko Sakkinen 2020-11-13 498 }
d2285493bef310 Jarkko Sakkinen 2020-11-13 499
5b8719504e3adf Jarkko Sakkinen 2021-03-18 500 /* Fall back to the non-local NUMA nodes: */
5b8719504e3adf Jarkko Sakkinen 2021-03-18 501 while (true) {
5b8719504e3adf Jarkko Sakkinen 2021-03-18 502 nid = next_node_in(nid, sgx_numa_mask);
5b8719504e3adf Jarkko Sakkinen 2021-03-18 503 if (nid == nid_of_current)
5b8719504e3adf Jarkko Sakkinen 2021-03-18 504 break;
5b8719504e3adf Jarkko Sakkinen 2021-03-18 505
5b8719504e3adf Jarkko Sakkinen 2021-03-18 506 page = __sgx_alloc_epc_page_from_node(nid);
5b8719504e3adf Jarkko Sakkinen 2021-03-18 507 if (page)
5b8719504e3adf Jarkko Sakkinen 2021-03-18 508 break;
5b8719504e3adf Jarkko Sakkinen 2021-03-18 509 }
5b8719504e3adf Jarkko Sakkinen 2021-03-18 510
5b8719504e3adf Jarkko Sakkinen 2021-03-18 511 return page;
d2285493bef310 Jarkko Sakkinen 2020-11-13 512 }
d2285493bef310 Jarkko Sakkinen 2020-11-13 513
:::::: The code at line 496 was first introduced by commit
:::::: d2285493bef310b66b56dfe4eb75c1e2f431ea5c x86/sgx: Add SGX page allocator functions
:::::: TO: Jarkko Sakkinen <jarkko@kernel.org>
:::::: CC: Borislav Petkov <bp@suse.de>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 27364 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: Jarkko Sakkinen <jarkko@kernel.org>
Cc: kbuild-all@lists.01.org, clang-built-linux@googlegroups.com,
linux-kernel@vger.kernel.org, x86@kernel.org,
Borislav Petkov <bp@suse.de>
Subject: [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
Date: Fri, 19 Mar 2021 05:03:21 +0800 [thread overview]
Message-ID: <202103190514.xH7IrKMe-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 6248 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/sgx
head: 5b8719504e3adf47646273781591ad439b3c3c7a
commit: 5b8719504e3adf47646273781591ad439b3c3c7a [2/2] x86/sgx: Add a basic NUMA allocation scheme to sgx_alloc_epc_page()
config: x86_64-randconfig-r004-20210318 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 6db3ab2903f42712f44000afb5aa467efbd25f35)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=5b8719504e3adf47646273781591ad439b3c3c7a
git remote add tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
git fetch --no-tags tip x86/sgx
git checkout 5b8719504e3adf47646273781591ad439b3c3c7a
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> arch/x86/kernel/cpu/sgx/main.c:496:7: warning: variable 'nid' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (page)
^~~~
arch/x86/kernel/cpu/sgx/main.c:502:22: note: uninitialized use occurs here
nid = next_node_in(nid, sgx_numa_mask);
^~~
include/linux/nodemask.h:278:46: note: expanded from macro 'next_node_in'
#define next_node_in(n, src) __next_node_in((n), &(src))
^
arch/x86/kernel/cpu/sgx/main.c:496:3: note: remove the 'if' if its condition is always true
if (page)
^~~~~~~~~
arch/x86/kernel/cpu/sgx/main.c:494:6: warning: variable 'nid' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (node_isset(nid_of_current, sgx_numa_mask)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/nodemask.h:152:36: note: expanded from macro 'node_isset'
#define node_isset(node, nodemask) test_bit((node), (nodemask).bits)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/kernel/cpu/sgx/main.c:502:22: note: uninitialized use occurs here
nid = next_node_in(nid, sgx_numa_mask);
^~~
include/linux/nodemask.h:278:46: note: expanded from macro 'next_node_in'
#define next_node_in(n, src) __next_node_in((n), &(src))
^
arch/x86/kernel/cpu/sgx/main.c:494:2: note: remove the 'if' if its condition is always true
if (node_isset(nid_of_current, sgx_numa_mask)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/kernel/cpu/sgx/main.c:492:9: note: initialize the variable 'nid' to silence this warning
int nid;
^
= 0
2 warnings generated.
vim +496 arch/x86/kernel/cpu/sgx/main.c
d2285493bef310 Jarkko Sakkinen 2020-11-13 477
d2285493bef310 Jarkko Sakkinen 2020-11-13 478 /**
d2285493bef310 Jarkko Sakkinen 2020-11-13 479 * __sgx_alloc_epc_page() - Allocate an EPC page
d2285493bef310 Jarkko Sakkinen 2020-11-13 480 *
5b8719504e3adf Jarkko Sakkinen 2021-03-18 481 * Iterate through NUMA nodes and reserve ia free EPC page to the caller. Start
5b8719504e3adf Jarkko Sakkinen 2021-03-18 482 * from the NUMA node, where the caller is executing.
d2285493bef310 Jarkko Sakkinen 2020-11-13 483 *
d2285493bef310 Jarkko Sakkinen 2020-11-13 484 * Return:
5b8719504e3adf Jarkko Sakkinen 2021-03-18 485 * - an EPC page: A borrowed EPC pages were available.
5b8719504e3adf Jarkko Sakkinen 2021-03-18 486 * - NULL: Out of EPC pages.
d2285493bef310 Jarkko Sakkinen 2020-11-13 487 */
d2285493bef310 Jarkko Sakkinen 2020-11-13 488 struct sgx_epc_page *__sgx_alloc_epc_page(void)
d2285493bef310 Jarkko Sakkinen 2020-11-13 489 {
d2285493bef310 Jarkko Sakkinen 2020-11-13 490 struct sgx_epc_page *page;
5b8719504e3adf Jarkko Sakkinen 2021-03-18 491 int nid_of_current = numa_node_id();
5b8719504e3adf Jarkko Sakkinen 2021-03-18 492 int nid;
d2285493bef310 Jarkko Sakkinen 2020-11-13 493
5b8719504e3adf Jarkko Sakkinen 2021-03-18 494 if (node_isset(nid_of_current, sgx_numa_mask)) {
5b8719504e3adf Jarkko Sakkinen 2021-03-18 495 page = __sgx_alloc_epc_page_from_node(nid_of_current);
d2285493bef310 Jarkko Sakkinen 2020-11-13 @496 if (page)
d2285493bef310 Jarkko Sakkinen 2020-11-13 497 return page;
d2285493bef310 Jarkko Sakkinen 2020-11-13 498 }
d2285493bef310 Jarkko Sakkinen 2020-11-13 499
5b8719504e3adf Jarkko Sakkinen 2021-03-18 500 /* Fall back to the non-local NUMA nodes: */
5b8719504e3adf Jarkko Sakkinen 2021-03-18 501 while (true) {
5b8719504e3adf Jarkko Sakkinen 2021-03-18 502 nid = next_node_in(nid, sgx_numa_mask);
5b8719504e3adf Jarkko Sakkinen 2021-03-18 503 if (nid == nid_of_current)
5b8719504e3adf Jarkko Sakkinen 2021-03-18 504 break;
5b8719504e3adf Jarkko Sakkinen 2021-03-18 505
5b8719504e3adf Jarkko Sakkinen 2021-03-18 506 page = __sgx_alloc_epc_page_from_node(nid);
5b8719504e3adf Jarkko Sakkinen 2021-03-18 507 if (page)
5b8719504e3adf Jarkko Sakkinen 2021-03-18 508 break;
5b8719504e3adf Jarkko Sakkinen 2021-03-18 509 }
5b8719504e3adf Jarkko Sakkinen 2021-03-18 510
5b8719504e3adf Jarkko Sakkinen 2021-03-18 511 return page;
d2285493bef310 Jarkko Sakkinen 2020-11-13 512 }
d2285493bef310 Jarkko Sakkinen 2020-11-13 513
:::::: The code at line 496 was first introduced by commit
:::::: d2285493bef310b66b56dfe4eb75c1e2f431ea5c x86/sgx: Add SGX page allocator functions
:::::: TO: Jarkko Sakkinen <jarkko@kernel.org>
:::::: CC: Borislav Petkov <bp@suse.de>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 27364 bytes --]
next reply other threads:[~2021-03-18 21:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-18 21:03 kernel test robot [this message]
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: x86/sgx] x86/sgx: Fix " tip-bot2 for Dave Hansen
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=202103190514.xH7IrKMe-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild-all@lists.01.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.