RFR: 8314114: Fix -Wconversion warnings in os code, primarily linux
Dean Long
dlong at openjdk.org
Thu Aug 10 20:20:59 UTC 2023
On Thu, 10 Aug 2023 15:22:07 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.
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.
src/hotspot/os/linux/os_linux.cpp line 1604:
> 1602:
> 1603: Elf32_Ehdr elf_head;
> 1604: size_t diag_msg_max_length=ebuflen-strlen(ebuf);
Underflow will result in very large unsigned number. Do we need helper functions for unsigned math that checks for underflow/overflow?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15229#discussion_r1290605284
PR Review Comment: https://git.openjdk.org/jdk/pull/15229#discussion_r1290619501
More information about the hotspot-dev
mailing list