diff options
author | Richard Weinberger <richard@nod.at> | 2015-03-03 23:41:52 +0100 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2015-03-26 23:27:49 +0100 |
commit | aad50b1e06081de0e4ff25335ab6f52e58bfcef1 (patch) | |
tree | 66773b2796b62f1204147b551e4d6356d3cf4765 /fs/hostfs/hostfs_kern.c | |
parent | hostfs: Make hostfs_readpage more readable (diff) | |
download | linux-aad50b1e06081de0e4ff25335ab6f52e58bfcef1.tar.xz linux-aad50b1e06081de0e4ff25335ab6f52e58bfcef1.zip |
hostfs: Add a BUG_ON to detect behavior changes of dentry_path_raw()
hostfs' __dentry_name() relies on the fact that dentry_path_raw() will place
the path name at the end of the provided buffer.
While this is okay, add a BUG_ON() to detect behavior changes as soon
as possible.
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'fs/hostfs/hostfs_kern.c')
-rw-r--r-- | fs/hostfs/hostfs_kern.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index 67e556cbfd82..3082a7e715dd 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c @@ -93,6 +93,13 @@ static char *__dentry_name(struct dentry *dentry, char *name) __putname(name); return NULL; } + + /* + * This function relies on the fact that dentry_path_raw() will place + * the path name at the end of the provided buffer. + */ + BUG_ON(p + strlen(p) + 1 != name + PATH_MAX); + strlcpy(name, root, PATH_MAX); if (len > p - name) { __putname(name); |