mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Zhiyu Zhang <zhiyuzhang999@gmail.com>
Cc: viro@zeniv.linux.org.uk, brauner@kernel.org,
	Jan Kara <jack@suse.cz>,
	hirofumi@mail.parknet.co.jp, linux-fsdevel@vger.kernel.org,
	syzkaller <syzkaller@googlegroups.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [Kernel Bug] WARNING in vfat_rmdir
Date: Tue, 30 Dec 2025 06:44:56 +0000	[thread overview]
Message-ID: <aVN06OKsKxZe6-Kv@casper.infradead.org> (raw)
In-Reply-To: <CALf2hKtp5SQCAzjkY8UvKU6Qqq4Qt=ZSjN18WK_BU==v4JOLuA@mail.gmail.com>

On Tue, Dec 30, 2025 at 02:18:17AM +0800, Zhiyu Zhang wrote:
> +++ b/fs/fat/dir.c
> @@ -92,8 +92,10 @@ static int fat__get_entry(struct inode *dir, loff_t *pos,
>         *bh = NULL;
>         iblock = *pos >> sb->s_blocksize_bits;
>         err = fat_bmap(dir, iblock, &phys, &mapped_blocks, 0, false);
> -       if (err || !phys)
> -               return -1;      /* beyond EOF or error */
> +       if (err)
> +               return err;     /* real error (e.g., -EIO, -EUCLEAN) */
> +       if (!phys)
> +               return -1;      /* beyond EOF */

Ooh, -1 is a real errno, so -1 or errno is a bad API.  I'd suggest just
returning -ENOENT directly instead of translating it in the caller.







  reply	other threads:[~2025-12-30  6:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-29 18:18 Zhiyu Zhang
2025-12-30  6:44 ` Matthew Wilcox [this message]
2025-12-30  8:00   ` Zhiyu Zhang
2025-12-30  7:37 ` Zhiyu Zhang
2025-12-31  4:41   ` OGAWA Hirofumi

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=aVN06OKsKxZe6-Kv@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=brauner@kernel.org \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzkaller@googlegroups.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=zhiyuzhang999@gmail.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

all inboxes | Powered by JetHome®