Skip to content

Commit

Permalink
8324280: RISC-V: Incorrect implementation in VM_Version::parse_satp_mode
Browse files Browse the repository at this point in the history
Backport-of: e7fdac9d5ce56d2f589df59a7fd2869e35ba2991
  • Loading branch information
zifeihan authored and RealFYang committed Jan 29, 2024
1 parent 291bd16 commit f5dc3ea
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/hotspot/os_cpu/linux_riscv/vm_version_linux_riscv.cpp
Expand Up @@ -169,13 +169,13 @@ void VM_Version::os_aux_features() {
}

VM_Version::VM_MODE VM_Version::parse_satp_mode(const char* vm_mode) {
if (!strcmp(vm_mode, "sv39")) {
if (!strncmp(vm_mode, "sv39", sizeof "sv39" - 1)) {
return VM_SV39;
} else if (!strcmp(vm_mode, "sv48")) {
} else if (!strncmp(vm_mode, "sv48", sizeof "sv48" - 1)) {
return VM_SV48;
} else if (!strcmp(vm_mode, "sv57")) {
} else if (!strncmp(vm_mode, "sv57", sizeof "sv57" - 1)) {
return VM_SV57;
} else if (!strcmp(vm_mode, "sv64")) {
} else if (!strncmp(vm_mode, "sv64", sizeof "sv64" - 1)) {
return VM_SV64;
} else {
return VM_MBARE;
Expand All @@ -197,7 +197,7 @@ char* VM_Version::os_uarch_additional_features() {
if ((p = strchr(buf, ':')) != nullptr) {
if (mode == VM_NOTSET) {
if (strncmp(buf, "mmu", sizeof "mmu" - 1) == 0) {
mode = VM_Version::parse_satp_mode(p);
mode = VM_Version::parse_satp_mode(p + 2);
}
}
if (ret == nullptr) {
Expand Down

1 comment on commit f5dc3ea

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.