[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CALf2hKvSQiJTGP3MQJWyR+F+cHagB+UnNMSuKroQAuDcAVbR6A@mail.gmail.com>
Date: Tue, 30 Dec 2025 16:00:37 +0800
From: Zhiyu Zhang <zhiyuzhang999@...il.com>
To: Matthew Wilcox <willy@...radead.org>
Cc: viro@...iv.linux.org.uk, brauner@...nel.org, Jan Kara <jack@...e.cz>,
hirofumi@...l.parknet.co.jp, linux-fsdevel@...r.kernel.org,
syzkaller <syzkaller@...glegroups.com>, linux-kernel@...r.kernel.org
Subject: Re: [Kernel Bug] WARNING in vfat_rmdir
Hi Matthew,
Thanks for your reply!
> 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.
I agree with this advice. I can let fat_get_entry() return -ENOENT like:
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)*/
+ if (!phys)
+ return -ENOENT; /* EOF */
Then I also need to re-handle the callers of fat_get_entry() as some
of them are still waiting for a "-1".
I'm willing to submit a patch to standardize the errno (though it
seems to unrelated to this bug), as long as it is approved :)
Best,
Zhiyu Zhang
Powered by blists - more mailing lists