diff options
| author | Christian Brauner <brauner@kernel.org> | 2026-01-29 10:07:17 +0100 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2026-01-29 10:09:06 +0100 |
| commit | 53e8441bfcbce064dcd6e0122e271fdd5f340419 (patch) | |
| tree | 56ca56737cc09b1855e8289a63f95ddfdf90d945 /include | |
| parent | 9396bfdacb5aa2bcb3d2242b0de527e7d4f8a3cd (diff) | |
| parent | 9cf8ddb12a728a5b9d814dc2c12dfc0959539f9c (diff) | |
Merge patch series "name_is_dot* cleanup"
Amir Goldstein <amir73il@gmail.com> says:
Following the syzbot ovl bug report and a fix by Qing Wang,
I decided to follow up with a small vfs cleanup of some
open coded version of checking "." and ".." name in readdir.
The fix patch is applied at the start of this cleanup series to allow
for easy backporting, but it is not an urgent fix so I don't think
there is a need to fast track it.
* patches from https://patch.msgid.link/20260128132406.23768-1-amir73il@gmail.com:
ovl: use name_is_dot* helpers in readdir code
fs: add helpers name_is_dot{,dot,_dotdot}
ovl: Fix uninit-value in ovl_fill_real
Link: https://patch.msgid.link/20260128132406.23768-1-amir73il@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/fs.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 094b0adcb035..95bb9a15e109 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2844,12 +2844,22 @@ u64 vfsmount_to_propagation_flags(struct vfsmount *mnt); extern char *file_path(struct file *, char *, int); +static inline bool name_is_dot(const char *name, size_t len) +{ + return unlikely(len == 1 && name[0] == '.'); +} + +static inline bool name_is_dotdot(const char *name, size_t len) +{ + return unlikely(len == 2 && name[0] == '.' && name[1] == '.'); +} + /** - * is_dot_dotdot - returns true only if @name is "." or ".." + * name_is_dot_dotdot - returns true only if @name is "." or ".." * @name: file name to check * @len: length of file name, in bytes */ -static inline bool is_dot_dotdot(const char *name, size_t len) +static inline bool name_is_dot_dotdot(const char *name, size_t len) { return len && unlikely(name[0] == '.') && (len == 1 || (len == 2 && name[1] == '.')); |
