]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
hostfs: Add a BUG_ON to detect behavior changes of dentry_path_raw()
authorRichard Weinberger <richard@nod.at>
Tue, 3 Mar 2015 22:41:52 +0000 (23:41 +0100)
committerRichard Weinberger <richard@nod.at>
Thu, 26 Mar 2015 22:27:49 +0000 (23:27 +0100)
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>
fs/hostfs/hostfs_kern.c

index 67e556cbfd82e4ae91981c4049f9526dcefc1f6b..3082a7e715dd9bafc5cf69c0c3dda1005a3f2e5b 100644 (file)
@@ -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);