Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1f73d491 authored by Eric Biggers's avatar Eric Biggers Committed by Theodore Ts'o
Browse files

f2fs: switch to using fscrypt_match_name()



Switch f2fs directory searches to use the fscrypt_match_name() helper
function.  There should be no functional change.

Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
Acked-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
parent 067d1023
Loading
Loading
Loading
Loading
+4 −24
Original line number Original line Diff line number Diff line
@@ -111,8 +111,6 @@ struct f2fs_dir_entry *find_target_dentry(struct fscrypt_name *fname,
	struct f2fs_dir_entry *de;
	struct f2fs_dir_entry *de;
	unsigned long bit_pos = 0;
	unsigned long bit_pos = 0;
	int max_len = 0;
	int max_len = 0;
	struct fscrypt_str de_name = FSTR_INIT(NULL, 0);
	struct fscrypt_str *name = &fname->disk_name;


	if (max_slots)
	if (max_slots)
		*max_slots = 0;
		*max_slots = 0;
@@ -130,29 +128,11 @@ struct f2fs_dir_entry *find_target_dentry(struct fscrypt_name *fname,
			continue;
			continue;
		}
		}


		if (de->hash_code != namehash)
		if (de->hash_code == namehash &&
			goto not_match;
		    fscrypt_match_name(fname, d->filename[bit_pos],

				       le16_to_cpu(de->name_len)))
		de_name.name = d->filename[bit_pos];
		de_name.len = le16_to_cpu(de->name_len);

#ifdef CONFIG_F2FS_FS_ENCRYPTION
		if (unlikely(!name->name)) {
			if (fname->usr_fname->name[0] == '_') {
				if (de_name.len > 32 &&
					!memcmp(de_name.name + ((de_name.len - 17) & ~15),
						fname->crypto_buf.name + 8, 16))
			goto found;
			goto found;
				goto not_match;

			}
			name->name = fname->crypto_buf.name;
			name->len = fname->crypto_buf.len;
		}
#endif
		if (de_name.len == name->len &&
				!memcmp(de_name.name, name->name, name->len))
			goto found;
not_match:
		if (max_slots && max_len > *max_slots)
		if (max_slots && max_len > *max_slots)
			*max_slots = max_len;
			*max_slots = max_len;
		max_len = 0;
		max_len = 0;