diff options
author | Will Deacon <will.deacon@arm.com> | 2014-08-26 15:13:22 +0100 |
---|---|---|
committer | Jiri Slaby <jslaby@suse.cz> | 2015-04-30 11:15:08 +0200 |
commit | 3594f00b2f7cd667f16a062ebb8fecedf8451174 (patch) | |
tree | 638e473bb32fd843e02a4c46cff96e8ef42c9159 /arch/arm | |
parent | 60731b1c244efd3192f1fb36c843a0a3add66599 (diff) | |
download | lwn-3594f00b2f7cd667f16a062ebb8fecedf8451174.tar.gz lwn-3594f00b2f7cd667f16a062ebb8fecedf8451174.zip |
KVM: ARM/arm64: avoid returning negative error code as bool
commit 18d457661fb9fa69352822ab98d39331c3d0e571 upstream.
is_valid_cache returns true if the specified cache is valid.
Unfortunately, if the parameter passed it out of range, we return
-ENOENT, which ends up as true leading to potential hilarity.
This patch returns false on the failure path instead.
Cc: Christoffer Dall <christoffer.dall@linaro.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Shannon Zhao <shannon.zhao@linaro.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/kvm/coproc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/arm/kvm/coproc.c b/arch/arm/kvm/coproc.c index 24edbdea617e..4dc9256d48a3 100644 --- a/arch/arm/kvm/coproc.c +++ b/arch/arm/kvm/coproc.c @@ -621,7 +621,7 @@ static bool is_valid_cache(u32 val) u32 level, ctype; if (val >= CSSELR_MAX) - return -ENOENT; + return false; /* Bottom bit is Instruction or Data bit. Next 3 bits are level. */ level = (val >> 1); |