Skip to content

Commit 48e6f22

Browse files
orzelmichalctmarinas
authored andcommitted
arm64: cputype: Avoid overflow using MIDR_IMPLEMENTOR_MASK
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 expressions implicitly casting it to u32. To avoid possible problems, fix the macro. Signed-off-by: Michal Orzel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent b6ba1a8 commit 48e6f22

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/arm64/include/asm/cputype.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#define MIDR_VARIANT(midr) \
3737
(((midr) & MIDR_VARIANT_MASK) >> MIDR_VARIANT_SHIFT)
3838
#define MIDR_IMPLEMENTOR_SHIFT 24
39-
#define MIDR_IMPLEMENTOR_MASK (0xff << MIDR_IMPLEMENTOR_SHIFT)
39+
#define MIDR_IMPLEMENTOR_MASK (0xffU << MIDR_IMPLEMENTOR_SHIFT)
4040
#define MIDR_IMPLEMENTOR(midr) \
4141
(((midr) & MIDR_IMPLEMENTOR_MASK) >> MIDR_IMPLEMENTOR_SHIFT)
4242

0 commit comments

Comments
 (0)