summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-01-16 20:16:52 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2015-01-16 20:16:52 +0100
commit62b1530065e9ced536ada063a4d0a748efa43cc8 (patch)
tree325866b16bff040efa2f866a838dce496ebdb4fa /fs
parentMerge tag 'tty-3.19-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gre... (diff)
parentkernfs: Fix kernfs_name_compare (diff)
downloadlinux-62b1530065e9ced536ada063a4d0a748efa43cc8.tar.xz
linux-62b1530065e9ced536ada063a4d0a748efa43cc8.zip
Merge tag 'driver-core-3.19-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core fix from Greg KH: "Here is one kernfs fix for a reported issue for 3.19-rc5. It has been in linux-next for a while" * tag 'driver-core-3.19-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: kernfs: Fix kernfs_name_compare
Diffstat (limited to 'fs')
-rw-r--r--fs/kernfs/dir.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/kernfs/dir.c b/fs/kernfs/dir.c
index 37989f02a226..2d881b381d2b 100644
--- a/fs/kernfs/dir.c
+++ b/fs/kernfs/dir.c
@@ -201,10 +201,14 @@ static unsigned int kernfs_name_hash(const char *name, const void *ns)
static int kernfs_name_compare(unsigned int hash, const char *name,
const void *ns, const struct kernfs_node *kn)
{
- if (hash != kn->hash)
- return hash - kn->hash;
- if (ns != kn->ns)
- return ns - kn->ns;
+ if (hash < kn->hash)
+ return -1;
+ if (hash > kn->hash)
+ return 1;
+ if (ns < kn->ns)
+ return -1;
+ if (ns > kn->ns)
+ return 1;
return strcmp(name, kn->name);
}