Integrated: 8314743: Use of uninitialized local in SR_initialize after JDK-8314114

Aleksey Shipilev shade at openjdk.org
Wed Aug 23 09:16:55 UTC 2023


On Tue, 22 Aug 2023 08:14:12 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

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

This pull request has now been integrated.

Changeset: 2be469f8
Author:    Aleksey Shipilev <shade at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/2be469f89ec10471e893045e606e1e2558f4e363
Stats:     2 lines in 1 file changed: 0 ins; 0 del; 2 mod

8314743: Use of uninitialized local in SR_initialize after JDK-8314114

Reviewed-by: dholmes, coleenp

-------------

PR: https://git.openjdk.org/jdk/pull/15381


More information about the hotspot-runtime-dev mailing list