RFR (XS) 8224033: os::snprintf should be used in virtualizationSupport.cpp
Thomas Stüfe
thomas.stuefe at gmail.com
Thu May 16 13:10:47 UTC 2019
Looks fine.
..Thomas
On Thu, May 16, 2019 at 1:02 PM Aleksey Shipilev <shade at redhat.com> wrote:
> Bug:
> https://bugs.openjdk.java.net/browse/JDK-8224033
>
> Fix:
>
> diff -r 382101e97784 src/hotspot/share/utilities/virtualizationSupport.cpp
> --- a/src/hotspot/share/utilities/virtualizationSupport.cpp Thu May 16
> 10:52:36 2019 +0200
> +++ b/src/hotspot/share/utilities/virtualizationSupport.cpp Thu May 16
> 13:00:35 2019 +0200
> @@ -66,5 +66,5 @@
> if (sg_error == VMGUESTLIB_ERROR_SUCCESS) {
> has_resource_information = true;
> - snprintf(extended_resource_info_at_startup,
> sizeof(extended_resource_info_at_startup), "%s",
> result_info);
> + os::snprintf(extended_resource_info_at_startup,
> sizeof(extended_resource_info_at_startup),
> "%s", result_info);
> GuestLib_StatFree(result_info, result_size);
> }
> @@ -72,5 +72,5 @@
> if (sg_error == VMGUESTLIB_ERROR_SUCCESS) {
> has_host_information = true;
> - snprintf(host_information, sizeof(host_information), "%s",
> result_info);
> + os::snprintf(host_information, sizeof(host_information), "%s",
> result_info);
> GuestLib_StatFree(result_info, result_size);
> }
>
>
> os::snprintf should be used in new code because -Wformat does not check
> raw snprintf (see
> JDK-8198918). It also fixes Windows build failure without PCH. Can run
> more tests on-demand, but I
> think it is trivial, so I only made the builds.
>
> Testing: {Linux, Windows} x86_64 fastdebug builds;
> --
> Thanks,
> -Aleksey
>
>
More information about the hotspot-dev
mailing list