<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 02:51:14 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-12285] Wrong variable scope used in jt_llog_print</title>
                <link>https://jira.whamcloud.com/browse/LU-12285</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;Issue found in b2_12. This issue lead to a sanity failure: sanity: FAIL: test_60aa old llog_print failed&lt;/p&gt;

&lt;p&gt;The wrong variable scope is used to assign default values to data.ioc_inlbuf2 and data.ioc_inlbuf3 in jt_llog_print()&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;int jt_llog_print(int argc, char **argv)
{
        struct obd_ioctl_data data;
        char rawbuf[MAX_IOC_BUFLEN], *buf = rawbuf;
        int rc;

        if (argc != 2 &amp;amp;&amp;amp; argc != 4)
                return CMD_HELP;

        memset(&amp;amp;data, 0, sizeof(data));
        data.ioc_dev = cur_device;
        data.ioc_inllen1 = strlen(argv[1]) + 1;
        data.ioc_inlbuf1 = argv[1];
        if (argc == 4) {
                data.ioc_inllen2 = strlen(argv[2]) + 1;
                data.ioc_inlbuf2 = argv[2];
                data.ioc_inllen3 = strlen(argv[3]) + 1;
                data.ioc_inlbuf3 = argv[3];
        } else {
                char from[2] = &quot;1&quot;, to[3] = &quot;-1&quot;;
                data.ioc_inllen2 = strlen(from) + 1;
                data.ioc_inlbuf2 = from;
                data.ioc_inllen3 = strlen(to) + 1;
                data.ioc_inlbuf3 = to;
        }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Declaring &quot;from&quot; and &quot;to&quot; inside the else block leads to undefined behavior.&lt;/p&gt;

&lt;p&gt;For example, with gcc 7.4.1 on sles 15 those buffers contain an empty string after exiting the else block.&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;int jt_llog_print(int argc, char **argv)
{
        struct obd_ioctl_data data;
        char rawbuf[MAX_IOC_BUFLEN], *buf = rawbuf;
        int rc;

        if (argc != 2 &amp;amp;&amp;amp; argc != 4)
                return CMD_HELP;

        memset(&amp;amp;data, 0, sizeof(data));
        data.ioc_dev = cur_device;
        data.ioc_inllen1 = strlen(argv[1]) + 1;
        data.ioc_inlbuf1 = argv[1];
        printf(&quot;argc: %d\n&quot;, argc);
        if (argc == 4) {
                data.ioc_inllen2 = strlen(argv[2]) + 1;
                data.ioc_inlbuf2 = argv[2];
                data.ioc_inllen3 = strlen(argv[3]) + 1;
                data.ioc_inlbuf3 = argv[3];
        } else {
                char from[2] = &quot;1&quot;, to[3] = &quot;-1&quot;;
                data.ioc_inllen2 = strlen(from) + 1;
                data.ioc_inlbuf2 = from;
                data.ioc_inllen3 = strlen(to) + 1;
                data.ioc_inlbuf3 = to;
        }
        printf(&quot;from: %s to: %s\n&quot;, data.ioc_inlbuf2, data.ioc_inlbuf3);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;sles15s01:/home/build/lustre-filesystem/lustre/tests # ../utils/lctl --device MGS llog_print lustre-client
argc: 2
from:  to:
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
</description>
                <environment></environment>
        <key id="55613">LU-12285</key>
            <summary>Wrong variable scope used in jt_llog_print</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="3">Duplicate</resolution>
                                        <assignee username="wc-triage">WC Triage</assignee>
                                    <reporter username="hornc">Chris Horn</reporter>
                        <labels>
                    </labels>
                <created>Fri, 10 May 2019 19:53:03 +0000</created>
                <updated>Fri, 10 May 2019 22:54:21 +0000</updated>
                            <resolved>Fri, 10 May 2019 22:54:21 +0000</resolved>
                                    <version>Lustre 2.12.2</version>
                                                        <due></due>
                            <votes>0</votes>
                                    <watches>3</watches>
                                                                            <comments>
                            <comment id="246987" author="hornc" created="Fri, 10 May 2019 19:56:08 +0000"  >&lt;p&gt;Sorry, I didn&apos;t check master before opening this ticket. I see the code has changed, so this probably isn&apos;t an issue there.&lt;/p&gt;</comment>
                            <comment id="246988" author="gerrit" created="Fri, 10 May 2019 20:00:59 +0000"  >&lt;p&gt;Chris Horn (hornc@cray.com) uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/34846&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/34846&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-12285&quot; title=&quot;Wrong variable scope used in jt_llog_print&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-12285&quot;&gt;&lt;del&gt;LU-12285&lt;/del&gt;&lt;/a&gt; utils: Correct variable scope in jt_llog_print&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: b2_12&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: dc309d8900610e0e201569f8be634d4fcad15979&lt;/p&gt;</comment>
                            <comment id="247016" author="adilger" created="Fri, 10 May 2019 22:49:28 +0000"  >&lt;p&gt;The better way to fix this is the backport of patch &lt;a href=&quot;https://review.whamcloud.com/34850&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/34850&lt;/a&gt; &quot;&lt;tt&gt;&lt;a href=&quot;https://jira.whamcloud.com/browse/LU-11566&quot; title=&quot;sanity test_60aa: llog_print_cb()) not enough space for print log records&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-11566&quot;&gt;&lt;del&gt;LU-11566&lt;/del&gt;&lt;/a&gt; utils: fix lctl llog_print for large configs&lt;/tt&gt;&quot;, since that also fixes the issue that &quot;&lt;tt&gt;lctl llog_print&lt;/tt&gt;&quot; doesn&apos;t work if the config log is larger than about 200 records.&lt;/p&gt;

&lt;p&gt;That patch was meant to be included into 2.12.0 but didn&apos;t quite make it, and should have been cherry-picked before now, but was missed for some reason.&lt;/p&gt;</comment>
                            <comment id="247017" author="hornc" created="Fri, 10 May 2019 22:51:30 +0000"  >&lt;p&gt;Okay, I agree with that. I&apos;ll abandon my patch for b2_12 and will take your backport for a spin. This ticket can be closed.&lt;/p&gt;</comment>
                            <comment id="247018" author="adilger" created="Fri, 10 May 2019 22:52:40 +0000"  >&lt;p&gt;What is interesting is that this bug existed for quite a while before it was fixed with the above patch:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;commit c5050e412572b00cbe93d8517d2d1f767bebfa92
Author:     phil &amp;lt;phil&amp;gt;
AuthorDate: Wed Dec 3 03:16:26 2003 +0000

    land v0.9.1 on HEAD, in preparation for a 1.0.x branch
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                            <comment id="247019" author="adilger" created="Fri, 10 May 2019 22:54:21 +0000"  >&lt;p&gt;Using patch &lt;a href=&quot;https://review.whamcloud.com/34850&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/34850&lt;/a&gt; to fix this on b2_12.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Related</name>
                                            <outwardlinks description="is related to ">
                                        <issuelink>
            <issuekey id="53809">LU-11566</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|i00g4f:</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>