RFR: 8314114: Fix -Wconversion warnings in os code, primarily linux [v7]
    Dean Long 
    dlong at openjdk.org
       
    Mon Aug 14 20:38:18 UTC 2023
    
    
  
On Mon, 14 Aug 2023 15:04:58 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 incrementally with one additional commit since the last revision:
> 
>   Use 'long' and fix -Wsign-compare warnings from previous edit.  Make max_len size_t in the three places.
Marked as reviewed by dlong (Reviewer).
src/hotspot/os/linux/os_linux.cpp line 1608:
> 1606:     // No more space in ebuf for additional diagnostics message
> 1607:     return nullptr;
> 1608:   }
Suggestion:
  size_t ebuf_len = strlen(ebuf);
  if (ebuflen <= ebuf_len) {
    // No more space in ebuf for additional diagnostics message
    return nullptr;
  }
  size_t diag_msg_max_length = ebuflen - ebuf_len;
src/hotspot/os/linux/os_linux.cpp line 1610:
> 1608:   }
> 1609: 
> 1610:   char* diag_msg_buf=ebuf+strlen(ebuf);
Suggestion:
  char* diag_msg_buf=ebuf+ebuf_len;
-------------
PR Review: https://git.openjdk.org/jdk/pull/15229#pullrequestreview-1577611177
PR Review Comment: https://git.openjdk.org/jdk/pull/15229#discussion_r1293942588
PR Review Comment: https://git.openjdk.org/jdk/pull/15229#discussion_r1293943491
    
    
More information about the hotspot-dev
mailing list