<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 02:14:53 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>Whamcloud Community JIRA</title>
    <link>https://jira.whamcloud.com</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.4.14</version>
        <build-number>940014</build-number>
        <build-date>05-12-2023</build-date>
    </build-info>


<item>
            <title>[LU-8128] static analysis tool detected potential NULL dereference in ldlm layer</title>
                <link>https://jira.whamcloud.com/browse/LU-8128</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;Dan Carpenter reported the following that detected by Parfait which is an Oracle static analysis tool. This was discovered by Lidza Louina from Oracle.&lt;br/&gt;
Here is what was reported by the tool:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;drivers/staging/lustre/lustre/ldlm/interval_tree.c
   399  void interval_erase(struct interval_node *node,
   400                      struct interval_node **root)
   401  {
   402          struct interval_node *child, *parent;
   403          &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; color;
   404  
   405          LASSERT(interval_is_intree(node));
   406          node-&amp;gt;in_intree = 0;
   407          &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (!node-&amp;gt;in_left) {
   408                  child = node-&amp;gt;in_right;
   409          } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (!node-&amp;gt;in_right) {
   410                  child = node-&amp;gt;in_left;
   411          } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; { &lt;span class=&quot;code-comment&quot;&gt;/* Both left and right child are not NULL */&lt;/span&gt;
   412                  struct interval_node *old = node;
   413  
   414                  node = interval_next(node);
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
It looks like interval_next() can &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; NULL.

   415                  child = node-&amp;gt;in_right;
   416                  parent = node-&amp;gt;in_parent;
   417                  color = node-&amp;gt;in_color;
   418  

Here is the interval_next() function:

drivers/staging/lustre/lustre/ldlm/interval_tree.c
   111  &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; struct interval_node *interval_next(struct interval_node *node)
   112  {
   113          &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (!node)
   114                  &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; NULL;
   115          &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (node-&amp;gt;in_right)
   116                  &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; interval_first(node-&amp;gt;in_right);
   117          &lt;span class=&quot;code-keyword&quot;&gt;while&lt;/span&gt; (node-&amp;gt;in_parent &amp;amp;&amp;amp; node_is_right_child(node))
                       ^^^^^^^^^^^^^^^
We assume that -&amp;gt;in_parent can be NULL here.  Is that actually possible?

   118                  node = node-&amp;gt;in_parent;
   119          &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; node-&amp;gt;in_parent;
   120  }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
        <key id="36864">LU-8128</key>
            <summary>static analysis tool detected potential NULL dereference in ldlm layer</summary>
                <type id="1" iconUrl="https://jira.whamcloud.com/secure/viewavatar?size=xsmall&amp;avatarId=11303&amp;avatarType=issuetype">Bug</type>
                                            <priority id="4" iconUrl="https://jira.whamcloud.com/images/icons/priorities/minor.svg">Minor</priority>
                        <status id="5" iconUrl="https://jira.whamcloud.com/images/icons/statuses/resolved.png" description="A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.">Resolved</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="6">Not a Bug</resolution>
                                        <assignee username="green">Oleg Drokin</assignee>
                                    <reporter username="simmonsja">James A Simmons</reporter>
                        <labels>
                    </labels>
                <created>Wed, 11 May 2016 17:35:48 +0000</created>
                <updated>Wed, 30 Aug 2023 21:36:31 +0000</updated>
                            <resolved>Fri, 13 May 2016 16:20:34 +0000</resolved>
                                    <version>Lustre 2.7.0</version>
                    <version>Lustre 2.5.3</version>
                    <version>Lustre 2.8.0</version>
                    <version>Lustre 2.9.0</version>
                                                        <due></due>
                            <votes>0</votes>
                                    <watches>5</watches>
                                                                            <comments>
                            <comment id="151903" author="pjones" created="Wed, 11 May 2016 18:51:33 +0000"  >&lt;p&gt;Oleg is looking into this&lt;/p&gt;</comment>
                            <comment id="152234" author="jay" created="Fri, 13 May 2016 15:59:30 +0000"  >&lt;p&gt;Since @node is obviously not NULL in the code snippet, interval_next() won&apos;t return NULL in that case.&lt;/p&gt;</comment>
                            <comment id="152238" author="green" created="Fri, 13 May 2016 16:20:04 +0000"  >&lt;p&gt;when we call interval_next there, the node-&amp;gt;in_right is not NULL (checked above), as such the interval next never gets to the while loop in question and goes under if (node-&amp;gt;in_right) condition that calls interval_first that does not return NULL unless node itself is NULL which cannot happen either in this case.&lt;/p&gt;</comment>
                            <comment id="152239" author="green" created="Fri, 13 May 2016 16:20:25 +0000"  >&lt;p&gt;also thanks to Jinshan for clearing this out.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Related</name>
                                            <outwardlinks description="is related to ">
                                        <issuelink>
            <issuekey id="23151">LU-4629</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                            <customfield id="customfield_10890" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10390" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hzybav:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10090" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10060" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Severity</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10022"><![CDATA[3]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        </customfields>
    </item>
</channel>
</rss>