RFR: 8314114: Fix -Wconversion warnings in os code, primarily linux [v2]

Dean Long dlong at openjdk.org
Fri Aug 11 07:03:31 UTC 2023


On Fri, 11 Aug 2023 02:48:47 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> src/hotspot/os/linux/cgroupSubsystem_linux.cpp line 497:
>> 
>>> 495: 
>>> 496:   if (quota > -1 && period > 0) {
>>> 497:     quota_count = (int)ceilf((float)quota / (float)period);
>> 
>> Should be OK except for the pathological case of quota near INT_MAX and period == 1.
>
> Are you concerned that the float representation of INT_MAX/1 could be INT_MAX+epsilon so the ceil function increases it to INT_MAX+1?

Yes, exactly, and we have hit similar bugs before.  But the bug seems harmless here.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15229#discussion_r1290960192


More information about the hotspot-dev mailing list