From: Qing Wang <wangqing7171@gmail.com>
To: miklos@szeredi.hu
Cc: amir73il@gmail.com, linux-kernel@vger.kernel.org,
linux-unionfs@vger.kernel.org,
syzbot+d130f98b2c265fae5297@syzkaller.appspotmail.com,
wangqing7171@gmail.com
Subject: Re: [PATCH v2] ovl: Fix uninit-value in ovl_fill_real
Date: Wed, 28 Jan 2026 10:42:12 +0800 [thread overview]
Message-ID: <20260128024212.1818250-1-wangqing7171@gmail.com> (raw)
In-Reply-To: <CAJfpegt9yLioW1dEmGYOfib=TcuWVom=Z+a+bN+jS_8wFie90Q@mail.gmail.com>
On Tue, 27 Jan 2026 at 19:19, Miklos Szeredi <miklos@szeredi.hu> wrote:
> diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c
> index 160960bb0ad0..9ea3cd11dd93 100644
> --- a/fs/overlayfs/readdir.c
> +++ b/fs/overlayfs/readdir.c
> @@ -755,7 +755,7 @@ static bool ovl_fill_real(struct dir_context *ctx, const char *name,
> struct dir_context *orig_ctx = rdt->orig_ctx;
> bool res;
>
> - if (rdt->parent_ino && strcmp(name, "..") == 0) {
> + if (rdt->parent_ino && namelen == 2 && !strncmp(name, "..", namelen)) {
>
> Yeah, and also the str... functions only make sense on null terminated
> strings, so that needs to be memcmp.
Thanks for your idea, but I think strncmp is same as memncmp in this case.
strncmp dons't use null terminated.
```
int strncmp(const char *cs, const char *ct, size_t count)
{
unsigned char c1, c2;
while (count) {
c1 = *cs++;
c2 = *ct++;
if (c1 != c2)
return c1 < c2 ? -1 : 1;
if (!c1)
break;
count--;
}
return 0;
}
```
What do you think?
--
Best Regards,
Qing
next prev parent reply other threads:[~2026-01-28 2:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-27 7:54 [PATCH] ovl: Fix uninit-value in ovl_fill_real Qing Wang
2026-01-27 10:42 ` Miklos Szeredi
2026-01-27 10:52 ` [PATCH v2] " Qing Wang
2026-01-27 11:09 ` Amir Goldstein
2026-01-28 0:43 ` Eric Biggers
2026-01-27 11:19 ` Miklos Szeredi
2026-01-28 2:42 ` Qing Wang [this message]
2026-01-28 10:19 ` Amir Goldstein
2026-01-28 10:36 ` Miklos Szeredi
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=20260128024212.1818250-1-wangqing7171@gmail.com \
--to=wangqing7171@gmail.com \
--cc=amir73il@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-unionfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=syzbot+d130f98b2c265fae5297@syzkaller.appspotmail.com \
/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