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

Dean Long dlong at openjdk.org
Thu Aug 10 23:46:29 UTC 2023


On Thu, 10 Aug 2023 22:52:30 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> This change fixes various -Wconversion warnings from files in the os directories and related, widening types or adding checked_cast<> where narrowing.
>> Tested with tier1 on linux/macosx/windows and tier1-4 on linux-x64-debug, windows-x64-debug.
>
> Coleen Phillimore has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains eight additional commits since the last revision:
> 
>  - Dean's suggested changes.
>  - Merge branch 'master' into os-conversion
>  - Fix cgroupSubsystem_linux.cpp
>  - Unset Wconversion for testing.
>  - Fix signals to take int buflen, fixed return types of syscalls
>  - Fix attachListener.cpp warnings.
>  - change send/recv parameter type to match OS.
>  - Fix -Wconversion warnings in os_linux.

src/hotspot/os/linux/attachListener_linux.cpp line 270:

> 268: 
> 269:   size_t off = 0;
> 270:   size_t left = max_len;

It might be better to use ssize_t here, because of code like
` left -= n;`
below.  If that underflows as unsigned then the loop won't terminate like it should.

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

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


More information about the hotspot-dev mailing list