Re: [PATCH v2 3/3] f2fs: Handle casefolding with Encryption

From: Eric Biggers
Date: Wed Nov 18 2020 - 01:27:37 EST


On Tue, Nov 17, 2020 at 10:22:28PM -0800, Daniel Rosenberg wrote:
> > > @@ -273,10 +308,14 @@ struct f2fs_dir_entry *f2fs_find_target_dentry(const struct f2fs_dentry_ptr *d,
> > > continue;
> > > }
> > >
> > > - if (de->hash_code == fname->hash &&
> > > - f2fs_match_name(d->inode, fname, d->filename[bit_pos],
> > > - le16_to_cpu(de->name_len)))
> > > - goto found;
> > > + if (de->hash_code == fname->hash) {
> > > + res = f2fs_match_name(d->inode, fname, d->filename[bit_pos],
> > > + le16_to_cpu(de->name_len));
> > > + if (res < 0)
> > > + return ERR_PTR(res);
> > > + else if (res)
> > > + goto found;
> > > + }
> >
> > Overly long line here. Also 'else if' is unnecessary, just use 'if'.
> >
> > - Eric
> The 0 case is important, since that reflects that the name was not found.

I meant doing the following:

if (res < 0)
return ERR_PTR(res);
if (res)
goto found;

It doesn't really matter, but usually kernel code doesn't use 'else' after an
early return.

- Eric