<div dir="ltr">Absolutely, yes. <div><br></div><div>The larger the allocated size, the more important. Linux kernel, by default, only protects a small area against NULL accesses; depending on distro, 4KB or 64 (?) KB. And the JVM, at various places, allocates in low-area ranges. So accessing NULL+<large offset> can actually land you at a valid unrelated address instead of faulting.</div><div><br></div><div>/Thomas</div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Fri, Jul 11, 2025 at 2:57 PM Baesken, Matthias <<a href="mailto:matthias.baesken@sap.com">matthias.baesken@sap.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div class="msg-1264223504381202044">
<div lang="en-DE" style="overflow-wrap: break-word;">
<div class="m_-1264223504381202044WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hi, when playing around with the GCC static analyzer (
<a href="https://developers.redhat.com/articles/2022/04/12/state-static-analysis-gcc-12-compiler" target="_blank">
https://developers.redhat.com/articles/2022/04/12/state-static-analysis-gcc-12-compiler</a> ) I noticed<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">a lot of complaints about missing NULL checks of malloc/calloc return values in the code base.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">While we check these return values for NULL at a lot of places in the codebase, it is not done always.<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Should we do it always (except 3<sup>rd</sup> party code probably where we do not want to have large diffs to upstream) ?<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Or is it considered not important enough to do it always?<u></u><u></u></span></p>
<p class="MsoNormal"><span lang="EN-US"><u></u> <u></u></span></p>
<p class="MsoNormal"><span lang="EN-US">Best regards, Matthias<u></u><u></u></span></p>
</div>
</div>
</div></blockquote></div>