Message ID | 20240918-statx-stable-linux-6-10-y-v1-1-8364a071074f@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Backport statx(..., NULL, AT_EMPTY_PATH, ...) | expand |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 5f07c1c377df..0e334aad85c5 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -3619,4 +3619,21 @@ extern int vfs_fadvise(struct file *file, loff_t offset, loff_t len, extern int generic_fadvise(struct file *file, loff_t offset, loff_t len, int advice); +static inline bool vfs_empty_path(int dfd, const char __user *path) +{ + char c; + + if (dfd < 0) + return false; + + /* We now allow NULL to be used for empty path. */ + if (!path) + return true; + + if (unlikely(get_user(c, path))) + return false; + + return !c; +} + #endif /* _LINUX_FS_H */