projects
/
xen.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fe02a53
)
xen/arm: Avoid overflow using MIDR_IMPLEMENTOR_MASK
author
Michal Orzel
<michal.orzel@arm.com>
Thu, 5 May 2022 11:59:06 +0000
(13:59 +0200)
committer
Stefano Stabellini
<stefano.stabellini@amd.com>
Wed, 3 Aug 2022 21:57:43 +0000
(14:57 -0700)
Value of macro MIDR_IMPLEMENTOR_MASK exceeds the range of integer
and can lead to overflow. Currently there is no issue as it is used
in an expression implicitly casted to u32 in MIDR_IS_CPU_MODEL_RANGE.
To avoid possible problems, fix the macro.
Signed-off-by: Michal Orzel <michal.orzel@arm.com>
Link:
https://lore.kernel.org/r/20220426070603.56031-1-michal.orzel@arm.com
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Julien Grall <jgrall@amazon.com>
(cherry picked from commit
aa1cba100bff84b211f27639bd6efeaf7e701bcc
)
xen/include/asm-arm/processor.h
patch
|
blob
|
history
diff --git
a/xen/include/asm-arm/processor.h
b/xen/include/asm-arm/processor.h
index 852b5f3c24b86ba76c138d18da76cd582d298be1..7a1c4c4410b562700f712e69e1d389345ac7b535 100644
(file)
--- a/
xen/include/asm-arm/processor.h
+++ b/
xen/include/asm-arm/processor.h
@@
-39,7
+39,7
@@
#define MIDR_VARIANT(midr) \
(((midr) & MIDR_VARIANT_MASK) >> MIDR_VARIANT_SHIFT)
#define MIDR_IMPLEMENTOR_SHIFT 24
-#define MIDR_IMPLEMENTOR_MASK (0xff << MIDR_IMPLEMENTOR_SHIFT)
+#define MIDR_IMPLEMENTOR_MASK (0xff
U
<< MIDR_IMPLEMENTOR_SHIFT)
#define MIDR_IMPLEMENTOR(midr) \
(((midr) & MIDR_IMPLEMENTOR_MASK) >> MIDR_IMPLEMENTOR_SHIFT)