RFR: 8315739: Missing null check in os::vm_min_address [v2]

Daniel Jeliński djelinski at openjdk.org
Tue Sep 12 09:24:39 UTC 2023


On Tue, 12 Sep 2023 08:57:01 GMT, Daniel Jeliński <djelinski at openjdk.org> wrote:

>> The existing code is overly complex. I think it can reduce to just:
>> 
>> if (f != nullptr) {
>>   fscanf(f, "%zu", &value);
>>   fclose(f);
>> }
>> value = MAX2(_vm_min_address_default, value);
>> 
>> though perhaps that makes an assumption that `value` is untouched if the conversion fails? I couldn't see anything definitive about that in the spec for it.
>
> I couldn't find any explicit statements in the spec either, but chances are good that it will just work. I'll make the change.

well, it triggers a warning:

warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]

I'm not a big fan of suppressing warnings. Can we keep the current version?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15596#discussion_r1322739485


More information about the hotspot-runtime-dev mailing list