xen/arm: Avoid overflow using MIDR_IMPLEMENTOR_MASK
PATCH v2 1/1 xen/arm: 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 an expression implicitly casted to u32 in MIDR_IS_CPU_MODEL_RANGE. To avoid possible problems, fix the macro.
Origin: git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git (48e6f22e25a4)
---
Changes since v1:
- add Origin tag as the patch was merged in upstream arm64 linux tree
--- xen/arch/arm/include/asm/processor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/include/asm/processor.h +1 -1
@@ -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 (0xffU << MIDR_IMPLEMENTOR_SHIFT)#define MIDR_IMPLEMENTOR (midr) \ (((midr) & MIDR_IMPLEMENTOR_MASK) >> MIDR_IMPLEMENTOR_SHIFT)
Signature · 1 line
2.25.1
Quoted 5 lines · Michal Orzel
Value of macro
MIDR_IMPLEMENTOR_MASKexceeds 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 inMIDR_IS_CPU_MODEL_RANGE. To avoid possible problems, fix the macro.
Quoted 7 lines
Signed-off-by Michal Orzel <[email protected]>Signed-off-by Catalin Marinas <[email protected]>Origin: git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git (
48e6f22e25a4)
---
Changes since v1:
- add Origin tag as the patch was merged in upstream arm64 linux tree
Note that there's always a risk that the commit Id will be changed before it hits mainline (Linus' tree).
Signature · 1 line
Catalin
Hi Catalin,
Quoted 14 lines · Catalin Marinas
Quoted 5 lines · Michal Orzel
Value of macro
MIDR_IMPLEMENTOR_MASKexceeds 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 inMIDR_IS_CPU_MODEL_RANGE. To avoid possible problems, fix the macro.Quoted 7 lines
Signed-off-by Michal Orzel <[email protected]>Signed-off-by Catalin Marinas <[email protected]>Origin: git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git (
48e6f22e25a4)
---
Changes since v1:
- add Origin tag as the patch was merged in upstream arm64 linux tree
Quoted 3 lines
Note that there's always a risk that the commit Id will be changed before it hits mainline (Linus' tree).
This commit is now in linux-next:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=48e6f22e25a44e43952db5fbb767dea0c9319cb2
so we can be sure that the SHA will stay unmodified there (and will be the same in Linus' tree).
Question to maintainers:
Do you want me to update Origin to point to linux-next?
Cheers,
Michal
Hi,
Quoted 15 lines · Michal Orzel
Quoted 14 lines · Catalin Marinas
Quoted 12 lines · Michal Orzel
Value of macro
MIDR_IMPLEMENTOR_MASKexceeds 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 inMIDR_IS_CPU_MODEL_RANGE. To avoid possible problems, fix the macro.Signed-off-by Michal Orzel <[email protected]>Signed-off-by Catalin Marinas <[email protected]>Origin: git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git (
48e6f22e25a4)
---
Changes since v1:
- add Origin tag as the patch was merged in upstream arm64 linux tree
Quoted 7 lines
Quoted 3 lines
Note that there's always a risk that the commit Id will be changed before it hits mainline (Linus' tree).
This commit is now in linux-next:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=48e6f22e25a44e43952db5fbb767dea0c9319cb2
so we can be sure that the SHA will stay unmodified there (and will be the same in Linus' tree).
AFAIK, linux-next branch is just a merge of all the maintainers branch and often rewritten. So there are no guarantee a commit id is valid until it reached Linus' tree.
Quoted 3 lines
Question to maintainers:
Do you want me to update Origin to point to linux-next?
So we have a link to the patch and a name. This should be sufficient to find the commit.
Therefore, I would simply on top of Origin:
[The commit ID may be different in linus' tree]
Signature · 1 line
Julien Grall
Hi Julien,
Quoted 5 lines · Julien Grall
Therefore, I would simply on top of Origin:
[The commit ID may be different in linus' tree]
Could you please do that on commit as this is just one line of commit change?
Thanks,
Michal
Catalin Marinas
Acked-byQuoted 22 lines · Julien Grall
Hi,
Quoted 19 lines · Michal Orzel
Quoted 17 lines · Catalin Marinas
Quoted 5 lines · Michal Orzel
Value of macro
MIDR_IMPLEMENTOR_MASKexceeds 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 inMIDR_IS_CPU_MODEL_RANGE. To avoid possible problems, fix the macro.Quoted 7 lines
Signed-off-by Michal Orzel <[email protected]>Signed-off-by Catalin Marinas <[email protected]>Origin: git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git (
48e6f22e25a4)
---
Changes since v1:
- add Origin tag as the patch was merged in upstream arm64 linux treeNote that there's always a risk that the commit Id will be changed before it hits mainline (Linus' tree).
Quoted 7 lines
Quoted 3 lines
This commit is now in linux-next:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=48e6f22e25a44e43952db5fbb767dea0c9319cb2
so we can be sure that the SHA will stay unmodified there (and will be the same in Linus' tree).AFAIK, linux-next branch is just a merge of all the maintainers branch and often rewritten. So there are no guarantee a commit id is valid until it reached Linus' tree.
Indeed. While I try not to rebase it, it may happen occasionally.
Quoted 7 lines
Quoted 2 lines
Question to maintainers:
Do you want me to update Origin to point to linux-next?So we have a link to the patch and a name. This should be sufficient to find the commit.
Therefore, I would simply on top of Origin:
Yeah, just keep the link to the mailing list. I guess you can drop my Singed-off-by as well if it appears to be picked from the list rather than the kernel repo. If you want an ack:
Signature · 1 line
Catalin
Hi Catalin,
Quoted 39 lines · Catalin Marinas
Quoted 22 lines · Julien Grall
Hi,
Quoted 19 lines · Michal Orzel
Quoted 17 lines · Catalin Marinas
Quoted 5 lines · Michal Orzel
Value of macro
MIDR_IMPLEMENTOR_MASKexceeds 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 inMIDR_IS_CPU_MODEL_RANGE. To avoid possible problems, fix the macro.Quoted 7 lines
Signed-off-by Michal Orzel <[email protected]>Signed-off-by Catalin Marinas <[email protected]>Origin: git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git (
48e6f22e25a4)
---
Changes since v1:
- add Origin tag as the patch was merged in upstream arm64 linux treeNote that there's always a risk that the commit Id will be changed before it hits mainline (Linus' tree).
Quoted 7 lines
Quoted 3 lines
This commit is now in linux-next:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=48e6f22e25a44e43952db5fbb767dea0c9319cb2
so we can be sure that the SHA will stay unmodified there (and will be the same in Linus' tree).AFAIK, linux-next branch is just a merge of all the maintainers branch and often rewritten. So there are no guarantee a commit id is valid until it reached Linus' tree.
Indeed. While I try not to rebase it, it may happen occasionally.
Quoted 6 lines
Quoted 2 lines
Question to maintainers:
Do you want me to update Origin to point to linux-next?So we have a link to the patch and a name. This should be sufficient to find the commit.
Quoted 7 lines
Quoted 1 line
Therefore, I would simply on top of Origin:
Yeah, just keep the link to the mailing list. I guess you can drop my Singed-off-by as well if it appears to be picked from the list rather than the kernel repo. If you want an ack:
Acked-by Catalin Marinas <[email protected]>
I have done what you suggested and committed. Thanks!
Cheers,
Signature · 1 line
Julien Grall