From 4f489580d7bec0b6dcf96cc4bf43183e697d8bbc Mon Sep 17 00:00:00 2001 From: Serguei Spitsyn Date: Fri, 7 Aug 2015 09:22:29 -0700 Subject: [PATCH] 8080401: Uninitialised variable in hotspot/src/os/solaris/dtrace/ Reduce the warnings Reviewed-by: sla, dsamersoff --- hotspot/src/os/bsd/dtrace/generateJvmOffsets.cpp | 2 +- hotspot/src/os/bsd/dtrace/jvm_dtrace.c | 7 +++---- hotspot/src/os/bsd/dtrace/libjvm_db.c | 2 +- hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp | 2 +- hotspot/src/os/solaris/dtrace/jvm_dtrace.c | 7 +++---- hotspot/src/os/solaris/dtrace/libjvm_db.c | 2 +- 6 files changed, 10 insertions(+), 12 deletions(-) diff --git a/hotspot/src/os/bsd/dtrace/generateJvmOffsets.cpp b/hotspot/src/os/bsd/dtrace/generateJvmOffsets.cpp index 4d695aea251..6e012a9bee1 100644 --- a/hotspot/src/os/bsd/dtrace/generateJvmOffsets.cpp +++ b/hotspot/src/os/bsd/dtrace/generateJvmOffsets.cpp @@ -134,7 +134,7 @@ StubQueue* AbstractInterpreter::_code = NULL; } void gen_prologue(GEN_variant gen_variant) { - const char *suffix; + const char *suffix = "Undefined-Suffix"; switch(gen_variant) { case GEN_OFFSET: suffix = ".h"; break; diff --git a/hotspot/src/os/bsd/dtrace/jvm_dtrace.c b/hotspot/src/os/bsd/dtrace/jvm_dtrace.c index 36d8b61b19f..58fc9197c7e 100644 --- a/hotspot/src/os/bsd/dtrace/jvm_dtrace.c +++ b/hotspot/src/os/bsd/dtrace/jvm_dtrace.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -227,7 +227,7 @@ static void delete_attach_file(pid_t pid) { /* attach to given JVM */ jvm_t* jvm_attach(pid_t pid) { jvm_t* jvm; - int door_fd, attach_fd, i; + int door_fd, attach_fd, i = 0; jvm = (jvm_t*) calloc(1, sizeof(jvm_t)); if (jvm == NULL) { @@ -292,14 +292,13 @@ const char* jvm_get_last_error() { /* detach the givenb JVM */ int jvm_detach(jvm_t* jvm) { if (jvm) { - int res; + int res = 0; if (jvm->door_fd != -1) { if (file_close(jvm->door_fd) != 0) { set_jvm_error(JVM_ERR_CANT_CLOSE_DOOR); res = -1; } else { clear_jvm_error(); - res = 0; } } free(jvm); diff --git a/hotspot/src/os/bsd/dtrace/libjvm_db.c b/hotspot/src/os/bsd/dtrace/libjvm_db.c index b483733f9ef..87a9afe24ff 100644 --- a/hotspot/src/os/bsd/dtrace/libjvm_db.c +++ b/hotspot/src/os/bsd/dtrace/libjvm_db.c @@ -882,7 +882,7 @@ get_real_pc(Nmethod_t *N, uint64_t pc_desc, uint64_t *real_pc) /* Finds a PcDesc with real-pc equal to N->pc */ static int pc_desc_at(Nmethod_t *N) { - uint64_t pc_diff; + uint64_t pc_diff = 999; int32_t offs; int32_t err; diff --git a/hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp b/hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp index c145be3a85e..ddd74b16d9e 100644 --- a/hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp +++ b/hotspot/src/os/solaris/dtrace/generateJvmOffsets.cpp @@ -129,7 +129,7 @@ StubQueue* AbstractInterpreter::_code = NULL; } void gen_prologue(GEN_variant gen_variant) { - const char *suffix; + const char *suffix = "Undefined-Suffix"; switch(gen_variant) { case GEN_OFFSET: suffix = ".h"; break; diff --git a/hotspot/src/os/solaris/dtrace/jvm_dtrace.c b/hotspot/src/os/solaris/dtrace/jvm_dtrace.c index 36d8b61b19f..58fc9197c7e 100644 --- a/hotspot/src/os/solaris/dtrace/jvm_dtrace.c +++ b/hotspot/src/os/solaris/dtrace/jvm_dtrace.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -227,7 +227,7 @@ static void delete_attach_file(pid_t pid) { /* attach to given JVM */ jvm_t* jvm_attach(pid_t pid) { jvm_t* jvm; - int door_fd, attach_fd, i; + int door_fd, attach_fd, i = 0; jvm = (jvm_t*) calloc(1, sizeof(jvm_t)); if (jvm == NULL) { @@ -292,14 +292,13 @@ const char* jvm_get_last_error() { /* detach the givenb JVM */ int jvm_detach(jvm_t* jvm) { if (jvm) { - int res; + int res = 0; if (jvm->door_fd != -1) { if (file_close(jvm->door_fd) != 0) { set_jvm_error(JVM_ERR_CANT_CLOSE_DOOR); res = -1; } else { clear_jvm_error(); - res = 0; } } free(jvm); diff --git a/hotspot/src/os/solaris/dtrace/libjvm_db.c b/hotspot/src/os/solaris/dtrace/libjvm_db.c index 1f24b8719ad..6bad77b68bb 100644 --- a/hotspot/src/os/solaris/dtrace/libjvm_db.c +++ b/hotspot/src/os/solaris/dtrace/libjvm_db.c @@ -882,7 +882,7 @@ get_real_pc(Nmethod_t *N, uint64_t pc_desc, uint64_t *real_pc) /* Finds a PcDesc with real-pc equal to N->pc */ static int pc_desc_at(Nmethod_t *N) { - uint64_t pc_diff; + uint64_t pc_diff = 999; int32_t offs; int32_t err;