RFR: 8314743: Use of uninitialized local in SR_initialize after JDK-8314114
Aleksey Shipilev
shade at openjdk.org
Tue Aug 22 08:22:46 UTC 2023
After [JDK-8314114](https://bugs.openjdk.org/browse/JDK-8314114), SonarCloud reports the use on uninitialized `sig` variable in the `warning` line here:
int SR_initialize() {
...
int sig;
bool result = parse_integer(s, &sig);
if (result && sig > MAX2(SIGSEGV, SIGBUS) && // See 4355769.
sig < NSIG) { // Must be legal signal and fit into sigflags[].
PosixSignals::SR_signum = sig;
} else {
warning("You set _JAVA_SR_SIGNUM=%d. It must be in range [%d, %d]. Using %d instead.",
sig, MAX2(SIGSEGV, SIGBUS)+1, NSIG-1, PosixSignals::SR_signum);
}
I think the proper fix is to print out the actual string value.
# Before the fix
% _JAVA_SR_SIGNUM=asdfiasodj1 build/macosx-aarch64-server-fastdebug/images/jdk/bin/java Alloc.java
OpenJDK 64-Bit Server VM warning: You set _JAVA_SR_SIGNUM=0. It must be in range [12, 31]. Using 31 instead.
# After the fix
% _JAVA_SR_SIGNUM=asdfiasodj1 build/macosx-aarch64-server-fastdebug/images/jdk/bin/java Alloc.java
OpenJDK 64-Bit Server VM warning: You set _JAVA_SR_SIGNUM=asdfiasodj1. It must be a number in range [12, 31]. Using 31 instead.
Attn @coleenp.
-------------
Commit messages:
- Fix
Changes: https://git.openjdk.org/jdk/pull/15381/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=15381&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8314743
Stats: 2 lines in 1 file changed: 0 ins; 0 del; 2 mod
Patch: https://git.openjdk.org/jdk/pull/15381.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/15381/head:pull/15381
PR: https://git.openjdk.org/jdk/pull/15381
More information about the hotspot-runtime-dev
mailing list