Skip to content

Commit e7fdac9

Browse files
MaxXSoftRealFYang
authored andcommitted
8324280: RISC-V: Incorrect implementation in VM_Version::parse_satp_mode
Reviewed-by: rehn, fyang
1 parent 3d32c46 commit e7fdac9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/hotspot/os_cpu/linux_riscv/vm_version_linux_riscv.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,13 @@ void VM_Version::os_aux_features() {
169169
}
170170

171171
VM_Version::VM_MODE VM_Version::parse_satp_mode(const char* vm_mode) {
172-
if (!strcmp(vm_mode, "sv39")) {
172+
if (!strncmp(vm_mode, "sv39", sizeof "sv39" - 1)) {
173173
return VM_SV39;
174-
} else if (!strcmp(vm_mode, "sv48")) {
174+
} else if (!strncmp(vm_mode, "sv48", sizeof "sv48" - 1)) {
175175
return VM_SV48;
176-
} else if (!strcmp(vm_mode, "sv57")) {
176+
} else if (!strncmp(vm_mode, "sv57", sizeof "sv57" - 1)) {
177177
return VM_SV57;
178-
} else if (!strcmp(vm_mode, "sv64")) {
178+
} else if (!strncmp(vm_mode, "sv64", sizeof "sv64" - 1)) {
179179
return VM_SV64;
180180
} else {
181181
return VM_MBARE;
@@ -197,7 +197,7 @@ char* VM_Version::os_uarch_additional_features() {
197197
if ((p = strchr(buf, ':')) != nullptr) {
198198
if (mode == VM_NOTSET) {
199199
if (strncmp(buf, "mmu", sizeof "mmu" - 1) == 0) {
200-
mode = VM_Version::parse_satp_mode(p);
200+
mode = VM_Version::parse_satp_mode(p + 2);
201201
}
202202
}
203203
if (ret == nullptr) {

0 commit comments

Comments
 (0)