RFR (XS) 8224033: os::snprintf should be used in virtualizationSupport.cpp

Aleksey Shipilev shade at redhat.com
Thu May 16 17:24:01 UTC 2019


Thanks, I am going to push this soon under triviality rules.

-Aleksey

On 5/16/19 3:10 PM, Thomas Stüfe wrote:
> Looks fine.
> 
> ..Thomas
> 
> On Thu, May 16, 2019 at 1:02 PM Aleksey Shipilev <shade at redhat.com <mailto: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
> 


-- 
Thanks,
-Aleksey

Red Hat GmbH, http://www.de.redhat.com/, Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Michael O'Neill, Tom Savage, Eric Shander



More information about the hotspot-dev mailing list