mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Li Tuo <islituo@gmail.com>
To: Dave Kleikamp <dave.kleikamp@oracle.com>
Cc: jfs-discussion@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, baijiaju1990@gmail.com
Subject: Re: [BUG] jfs: possible uninitialized-variable access in xtSplitUp()
Date: Tue, 3 Aug 2021 10:46:28 +0800	[thread overview]
Message-ID: <09905e41-c450-df22-45bb-746be314ecc5@gmail.com> (raw)
In-Reply-To: <a01909f1-19d9-8b3e-f772-3aa03b9b139c@oracle.com>

Thanks for your feedback, and any feedback about the further check would 
be appreciated!

Best wishes,
Tuo Li

On 2021/8/3 3:04, Dave Kleikamp wrote:
> On 7/31/21 1:31 AM, Li Tuo wrote:
>> Hello,
>>
>> Our static analysis tool finds a possible uninitialized-variable 
>> access in the jfs driver in Linux 5.14.0-rc3:
>>
>> At the beginning of the function xtSplitUp(), the variable rbn is not 
>> initialized.
>> If sp->header.flag & BT_ROOT is true,
>> 780:    rc = (sp->header.flag & BT_ROOT) ? xtSplitRoot(tid, ip, 
>> split, &rmp) : xtSplitPage(tid, ip, split, &rmp, &rbn);
>>
>> the varialbe rbn will remain uninitialized.
>> However, it is accessed through:
>> 814:    rcbn = rbn;
>>
>> I am not quite sure whether this possible uninitialized-variable 
>> access is real and how to fix it if it is real.
>> Any feedback would be appreciated, thanks!
>
> I think the logic that protects us is that in the case where rbn is 
> uninitialized, sp->header.flag & BT_ROOT, which means it SHOULD BE the 
> last entry in btstack, so we shouldn't enter the loop:
>     while ((parent = BT_POP(btstack)) != NULL) {
>
> It does seem that some type of sanity check is warranted. I'll take a 
> closer look and see if I can add some kind of error path if things are 
> out of sync.
>
>>
>> Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
>>
>> Best wishes,
>> Tuo Li


      reply	other threads:[~2021-08-03  2:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-31  6:31 Li Tuo
2021-08-02 19:04 ` Dave Kleikamp
2021-08-03  2:46   ` Li Tuo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=09905e41-c450-df22-45bb-746be314ecc5@gmail.com \
    --to=islituo@gmail.com \
    --cc=baijiaju1990@gmail.com \
    --cc=dave.kleikamp@oracle.com \
    --cc=jfs-discussion@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®