mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
kernfs: fix off by one error.
The hash values 0 and 1 are reserved for magic directory entries, but the code only prevents names hashing to 0. This patch fixes the test to also prevent hash value 1. Signed-off-by: Richard Cochran <[email protected]> Cc: <[email protected]> Reviewed-by: "Eric W. Biederman" <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
13df797743
commit
88391d49ab
1 changed files with 1 additions and 1 deletions
|
|
@ -190,7 +190,7 @@ static unsigned int kernfs_name_hash(const char *name, const void *ns)
|
|||
hash = (end_name_hash(hash) ^ hash_ptr((void *)ns, 31));
|
||||
hash &= 0x7fffffffU;
|
||||
/* Reserve hash numbers 0, 1 and INT_MAX for magic directory entries */
|
||||
if (hash < 1)
|
||||
if (hash < 2)
|
||||
hash += 2;
|
||||
if (hash >= INT_MAX)
|
||||
hash = INT_MAX - 1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue