From: kernel test robot <lkp@intel.com>
To: Baoquan He <bhe@redhat.com>
Cc: oe-kbuild-all@lists.linux.dev,
Linux Memory Management List <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: [linux-next:master 6231/6992] kernel/events/core.c:7477 perf_virt_to_phys() warn: always true condition '(virt >= (0)) => (0-u64max >= 0)'
Date: Tue, 12 Dec 2023 04:37:13 +0800 [thread overview]
Message-ID: <202312120428.kUWabWlC-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: bbd220ce4e29ed55ab079007cff0b550895258eb
commit: 8a651e8f1fca74c7c2b033d9a0ad5214ac5d46e4 [6231/6992] riscv: fix VMALLOC_START definition
config: riscv-randconfig-r071-20231211 (https://download.01.org/0day-ci/archive/20231212/202312120428.kUWabWlC-lkp@intel.com/config)
compiler: riscv64-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231212/202312120428.kUWabWlC-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312120428.kUWabWlC-lkp@intel.com/
New smatch warnings:
kernel/events/core.c:7477 perf_virt_to_phys() warn: always true condition '(virt >= (0)) => (0-u64max >= 0)'
drivers/clk/ingenic/tcu.c:455 ingenic_tcu_probe() warn: 'tcu->clk' from clk_prepare_enable() not released on lines: 455.
Old smatch warnings:
arch/riscv/include/asm/atomic.h:225 arch_atomic64_fetch_add_unless() warn: inconsistent indenting
arch/riscv/include/asm/atomic.h:204 arch_atomic_fetch_add_unless() warn: inconsistent indenting
vim +7477 kernel/events/core.c
5622f295b53fb6 kernel/perf_counter.c Markus Metzger 2009-09-15 7466
fc7ce9c74c3ad2 kernel/events/core.c Kan Liang 2017-08-28 7467 static u64 perf_virt_to_phys(u64 virt)
fc7ce9c74c3ad2 kernel/events/core.c Kan Liang 2017-08-28 7468 {
fc7ce9c74c3ad2 kernel/events/core.c Kan Liang 2017-08-28 7469 u64 phys_addr = 0;
fc7ce9c74c3ad2 kernel/events/core.c Kan Liang 2017-08-28 7470
fc7ce9c74c3ad2 kernel/events/core.c Kan Liang 2017-08-28 7471 if (!virt)
fc7ce9c74c3ad2 kernel/events/core.c Kan Liang 2017-08-28 7472 return 0;
fc7ce9c74c3ad2 kernel/events/core.c Kan Liang 2017-08-28 7473
fc7ce9c74c3ad2 kernel/events/core.c Kan Liang 2017-08-28 7474 if (virt >= TASK_SIZE) {
fc7ce9c74c3ad2 kernel/events/core.c Kan Liang 2017-08-28 7475 /* If it's vmalloc()d memory, leave phys_addr as 0 */
fc7ce9c74c3ad2 kernel/events/core.c Kan Liang 2017-08-28 7476 if (virt_addr_valid((void *)(uintptr_t)virt) &&
fc7ce9c74c3ad2 kernel/events/core.c Kan Liang 2017-08-28 @7477 !(virt >= VMALLOC_START && virt < VMALLOC_END))
fc7ce9c74c3ad2 kernel/events/core.c Kan Liang 2017-08-28 7478 phys_addr = (u64)virt_to_phys((void *)(uintptr_t)virt);
fc7ce9c74c3ad2 kernel/events/core.c Kan Liang 2017-08-28 7479 } else {
fc7ce9c74c3ad2 kernel/events/core.c Kan Liang 2017-08-28 7480 /*
fc7ce9c74c3ad2 kernel/events/core.c Kan Liang 2017-08-28 7481 * Walking the pages tables for user address.
fc7ce9c74c3ad2 kernel/events/core.c Kan Liang 2017-08-28 7482 * Interrupts are disabled, so it prevents any tear down
fc7ce9c74c3ad2 kernel/events/core.c Kan Liang 2017-08-28 7483 * of the page tables.
dadbb612f6e50b kernel/events/core.c Souptick Joarder 2020-06-07 7484 * Try IRQ-safe get_user_page_fast_only first.
fc7ce9c74c3ad2 kernel/events/core.c Kan Liang 2017-08-28 7485 * If failed, leave phys_addr as 0.
fc7ce9c74c3ad2 kernel/events/core.c Kan Liang 2017-08-28 7486 */
d3296fb372bf74 kernel/events/core.c Jiri Olsa 2020-04-07 7487 if (current->mm != NULL) {
4716023a8f6a0f kernel/events/core.c Greg Thelen 2021-11-10 7488 struct page *p;
4716023a8f6a0f kernel/events/core.c Greg Thelen 2021-11-10 7489
d3296fb372bf74 kernel/events/core.c Jiri Olsa 2020-04-07 7490 pagefault_disable();
4716023a8f6a0f kernel/events/core.c Greg Thelen 2021-11-10 7491 if (get_user_page_fast_only(virt, 0, &p)) {
fc7ce9c74c3ad2 kernel/events/core.c Kan Liang 2017-08-28 7492 phys_addr = page_to_phys(p) + virt % PAGE_SIZE;
4716023a8f6a0f kernel/events/core.c Greg Thelen 2021-11-10 7493 put_page(p);
4716023a8f6a0f kernel/events/core.c Greg Thelen 2021-11-10 7494 }
d3296fb372bf74 kernel/events/core.c Jiri Olsa 2020-04-07 7495 pagefault_enable();
d3296fb372bf74 kernel/events/core.c Jiri Olsa 2020-04-07 7496 }
fc7ce9c74c3ad2 kernel/events/core.c Kan Liang 2017-08-28 7497 }
fc7ce9c74c3ad2 kernel/events/core.c Kan Liang 2017-08-28 7498
fc7ce9c74c3ad2 kernel/events/core.c Kan Liang 2017-08-28 7499 return phys_addr;
fc7ce9c74c3ad2 kernel/events/core.c Kan Liang 2017-08-28 7500 }
fc7ce9c74c3ad2 kernel/events/core.c Kan Liang 2017-08-28 7501
:::::: The code at line 7477 was first introduced by commit
:::::: fc7ce9c74c3ad232b084d80148654f926d01ece7 perf/core, x86: Add PERF_SAMPLE_PHYS_ADDR
:::::: TO: Kan Liang <kan.liang@intel.com>
:::::: CC: Ingo Molnar <mingo@kernel.org>
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next reply other threads:[~2023-12-11 20:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-11 20:37 kernel test robot [this message]
2023-12-12 1:23 ` Baoquan He
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=202312120428.kUWabWlC-lkp@intel.com \
--to=lkp@intel.com \
--cc=akpm@linux-foundation.org \
--cc=bhe@redhat.com \
--cc=linux-mm@kvack.org \
--cc=oe-kbuild-all@lists.linux.dev \
/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