linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Zi Yan <ziy@nvidia.com>
To: Matthew Wilcox <willy@infradead.org>,
	Dan Carpenter <dan.carpenter@linaro.org>
Cc: oe-kbuild@lists.linux.dev, lkp@intel.com,
	oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Memory Management List <linux-mm@kvack.org>,
	Baolin Wang <baolin.wang@linux.alibaba.com>
Subject: Re: mm/shmem.c:2223 shmem_split_large_entry() error: uninitialized symbol 'entry_order'.
Date: Wed, 18 Jun 2025 13:53:23 -0400	[thread overview]
Message-ID: <2C5E9AD1-A548-4B29-98C2-DB4A78D51B4D@nvidia.com> (raw)
In-Reply-To: <aFL7zYgdMoqNbJBS@casper.infradead.org>

On 18 Jun 2025, at 13:47, Matthew Wilcox wrote:

> On Wed, Jun 18, 2025 at 08:42:17PM +0300, Dan Carpenter wrote:
>> smatch warnings:
>> mm/shmem.c:2223 shmem_split_large_entry() error: uninitialized symbol 'entry_order'.
>
> ...
>
>> 12885cbe88ddf6 Baolin Wang 2024-08-12  2169  		if (!xa_is_value(old) || swp_to_radix_entry(swap) != old) {
>> 12885cbe88ddf6 Baolin Wang 2024-08-12  2170  			xas_set_err(&xas, -EEXIST);
>> 12885cbe88ddf6 Baolin Wang 2024-08-12  2171  			goto unlock;
>>
>> Imagine we hit this goto on the first iteration
>
> That can happen (but if it does, we set -EEXIST in the xa_state).
>
>> 12885cbe88ddf6 Baolin Wang 2024-08-12  2213  unlock:
>> 12885cbe88ddf6 Baolin Wang 2024-08-12  2214  		xas_unlock_irq(&xas);
>> 12885cbe88ddf6 Baolin Wang 2024-08-12  2215
>> 12885cbe88ddf6 Baolin Wang 2024-08-12  2216  		if (!xas_nomem(&xas, gfp))
>> 12885cbe88ddf6 Baolin Wang 2024-08-12  2217  			break;
>>
>> And we hit this break.
>
> That's guaranteed.  If there's an errno in the xa_state that isn't
> -ENOMEM, xas_nomem() will fail.
>
>> 12885cbe88ddf6 Baolin Wang 2024-08-12  2218  	}
>> 12885cbe88ddf6 Baolin Wang 2024-08-12  2219
>> 12885cbe88ddf6 Baolin Wang 2024-08-12  2220  	if (xas_error(&xas))
>> 12885cbe88ddf6 Baolin Wang 2024-08-12  2221  		return xas_error(&xas);
>> 12885cbe88ddf6 Baolin Wang 2024-08-12  2222
>> d53c78fffe7ad3 Zi Yan      2025-03-14 @2223  	return entry_order;
>
> but if this does happen, then xas_error() will be true and we'll return
> -EEXIST here instead of returning entry_order.
Hi Matthew,

Thank you for the explanation.

Hi Dan,

I got a similar report 3 months ago and explained it already.
See https://lore.kernel.org/linux-mm/B024C29C-96D4-4F92-B2EF-F01CB06B27DF@nvidia.com/

Best Regards,
Yan, Zi


      reply	other threads:[~2025-06-18 17:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-18 17:42 Dan Carpenter
2025-06-18 17:47 ` Matthew Wilcox
2025-06-18 17:53   ` Zi Yan [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=2C5E9AD1-A548-4B29-98C2-DB4A78D51B4D@nvidia.com \
    --to=ziy@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=dan.carpenter@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=oe-kbuild@lists.linux.dev \
    --cc=willy@infradead.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