diff mbox series

[13/22] bfs_add_entry(): get rid of pointless ->d_name.len checks

Message ID 20231220052536.GL1674809@ZenIV (mailing list archive)
State New
Headers show
Series PATCH 01/22] hostfs: use d_splice_alias() calling conventions to simplify failure exits | expand

Commit Message

Al Viro Dec. 20, 2023, 5:25 a.m. UTC
First of all, any dentry getting here would have passed bfs_lookup(),
so it it passed ENAMETOOLONG check there, there's no need to
repeat it.  And we are not going to get dentries with zero name length -
that check ultimately comes from ext2 and it's as pointless here as it
used to be there.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
 fs/bfs/dir.c | 5 -----
 1 file changed, 5 deletions(-)

Comments

Tigran Aivazian Dec. 20, 2023, 11:03 a.m. UTC | #1
Hi Al and All,

On Wed, 20 Dec 2023 at 05:25, Al Viro <viro@zeniv.linux.org.uk> wrote:
>
> First of all, any dentry getting here would have passed bfs_lookup(),
> so it it passed ENAMETOOLONG check there, there's no need to
> repeat it.  And we are not going to get dentries with zero name length -
> that check ultimately comes from ext2 and it's as pointless here as it
> used to be there.

Yes, you are absolutely right, of course -- I must have looked at ext3
(I think it was ext3, not ext2) code at the time I wrote this and
assumed that it was necessary.

Kind regards,
Tigran

Acknowledged-by: Tigran Aivazian <aivazian.tigran@gmail.com>

>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> ---
>  fs/bfs/dir.c | 5 -----
>  1 file changed, 5 deletions(-)
>
> diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c
> index fbc4ae80a4b2..c375e22c4c0c 100644
> --- a/fs/bfs/dir.c
> +++ b/fs/bfs/dir.c
> @@ -275,11 +275,6 @@ static int bfs_add_entry(struct inode *dir, const struct qstr *child, int ino)
>
>         dprintf("name=%s, namelen=%d\n", name, namelen);
>
> -       if (!namelen)
> -               return -ENOENT;
> -       if (namelen > BFS_NAMELEN)
> -               return -ENAMETOOLONG;
> -
>         sblock = BFS_I(dir)->i_sblock;
>         eblock = BFS_I(dir)->i_eblock;
>         for (block = sblock; block <= eblock; block++) {
> --
> 2.39.2
>
diff mbox series

Patch

diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c
index fbc4ae80a4b2..c375e22c4c0c 100644
--- a/fs/bfs/dir.c
+++ b/fs/bfs/dir.c
@@ -275,11 +275,6 @@  static int bfs_add_entry(struct inode *dir, const struct qstr *child, int ino)
 
 	dprintf("name=%s, namelen=%d\n", name, namelen);
 
-	if (!namelen)
-		return -ENOENT;
-	if (namelen > BFS_NAMELEN)
-		return -ENAMETOOLONG;
-
 	sblock = BFS_I(dir)->i_sblock;
 	eblock = BFS_I(dir)->i_eblock;
 	for (block = sblock; block <= eblock; block++) {