RFR (XS) 8224033: os::snprintf should be used in virtualizationSupport.cpp
Baesken, Matthias
matthias.baesken at sap.com
Thu May 16 11:44:09 UTC 2019
Hi Aleksey , thanks for the fix, I think os::snprintf is the way to go .
( not a Reviewer however )
However , with VS2017 the windows x86_64 build works as well with PCH disabled .
So it seems to me that it is not (only) a PCH related issue .
I think it might be related to the Visual studio version used (we use VS2017 ) ; I did not see your VS version in the bug .
But anyway, os::snprintf sounds good to me !
Best regards, Matthias
> Message: 5
> Date: Thu, 16 May 2019 13:01:28 +0200
> From: Aleksey Shipilev <shade at redhat.com>
> To: "hotspot-dev at openjdk.java.net" <hotspot-dev at openjdk.java.net>
> Subject: RFR (XS) 8224033: os::snprintf should be used in
> virtualizationSupport.cpp
> Message-ID: <60913fe2-f2d1-41c7-5253-8e6aa6a35ec1 at redhat.com>
> Content-Type: text/plain; charset=utf-8
>
> 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;
More information about the hotspot-dev
mailing list