[Qemu-devel] [PATCH] target/arm: Stop unintentional sign extension in pmu_init

Aaron Lindsay OS posted 1 patch 5 years, 1 month ago
Test docker-clang@ubuntu failed
Test asan failed
Test docker-mingw@fedora passed
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20190219144621.450-1-aaron@os.amperecomputing.com
Maintainers: Peter Maydell <peter.maydell@linaro.org>
target/arm/helper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[Qemu-devel] [PATCH] target/arm: Stop unintentional sign extension in pmu_init
Posted by Aaron Lindsay OS 5 years, 1 month ago
This was introduced by
    commit bf8d09694ccc07487cd73d7562081fdaec3370c8
    target/arm: Don't clear supported PMU events when initializing PMCEID1
and identified by Coverity (CID 1398645).

Signed-off-by: Aaron Lindsay <aaron@os.amperecomputing.com>
Reported-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/arm/helper.c b/target/arm/helper.c
index a018eb23fe..5a29bc9799 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -1167,7 +1167,7 @@ void pmu_init(ARMCPU *cpu)
 
         if (cnt->supported(&cpu->env)) {
             supported_event_map[cnt->number] = i;
-            uint64_t event_mask = 1 << (cnt->number & 0x1f);
+            uint64_t event_mask = 1ULL << (cnt->number & 0x1f);
             if (cnt->number & 0x20) {
                 cpu->pmceid1 |= event_mask;
             } else {
-- 
2.20.1


Re: [Qemu-devel] [PATCH] target/arm: Stop unintentional sign extension in pmu_init
Posted by Peter Maydell 5 years, 1 month ago
On Tue, 19 Feb 2019 at 14:46, Aaron Lindsay OS
<aaron@os.amperecomputing.com> wrote:
>
> This was introduced by
>     commit bf8d09694ccc07487cd73d7562081fdaec3370c8
>     target/arm: Don't clear supported PMU events when initializing PMCEID1
> and identified by Coverity (CID 1398645).
>
> Signed-off-by: Aaron Lindsay <aaron@os.amperecomputing.com>
> Reported-by: Peter Maydell <peter.maydell@linaro.org>



Applied to target-arm.next, thanks.

-- PMM