mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 20:32:04 +09:00
KVM: ARM/arm64: avoid returning negative error code as bool
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>
(cherry picked from commit 18d457661f)
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
This commit is contained in:
committed by
Christoffer Dall
parent
0251cb8ae7
commit
563d813862
@@ -791,7 +791,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);
|
||||
|
||||
@@ -1218,7 +1218,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);
|
||||
|
||||
Reference in New Issue
Block a user