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
Reviewed-by: rehn, fyang
  • Loading branch information
MaxXSoft authored and RealFYang committed Jan 25, 2024
1 parent 3d32c46 commit e7fdac9
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
Original file line number Diff line number Diff line change
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 e7fdac9

@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.