Message ID | 20240918-statx-stable-linux-5-15-y-v1-2-5afb4401ddbe@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 27da89d0ed5a..6fe2ae89bba6 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -3736,4 +3736,21 @@ static inline int inode_drain_writes(struct inode *inode) return filemap_write_and_wait(inode->i_mapping); } +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 */