[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sdl-qemu] [PATCH v1] /hw/intc/arm_gic WRONG ARGUMENTS
From: |
Alex Bennée |
Subject: |
Re: [sdl-qemu] [PATCH v1] /hw/intc/arm_gic WRONG ARGUMENTS |
Date: |
Mon, 06 May 2024 11:02:34 +0100 |
Andrey Shumilin <shum.sdl@nppct.ru> writes:
> 1 Possibly mismatched call arguments in function 'gic_apr_ns_view': 'cpu' and
> 'regno' passed in place of 'int regno' and 'int
> cpu'.
> 2 Possibly mismatched call arguments in function 'gic_apr_write_ns_view':
> 'cpu' and 'regno' passed in place of 'int regno' and
> 'int cpu'.
>
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
So this purely a heuristic test based on the parameter names?
>
> From 23b142f5046ba9d3aec57217f6d8f3127f9bff69 Mon Sep 17 00:00:00 2001
> From: Andrey Shumilin <shum.sdl@nppct.ru>
> Date: Sun, 5 May 2024 20:13:40 +0300
> Subject: [PATCH] Patch hw/intc/arm_gic.c
>
> Signed-off-by: Andrey Shumilin <shum.sdl@nppct.ru>
> ---
> hw/intc/arm_gic.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c
> index 7a34bc0998..47f01e45e3 100644
> --- a/hw/intc/arm_gic.c
> +++ b/hw/intc/arm_gic.c
> @@ -1658,7 +1658,7 @@ static MemTxResult gic_cpu_read(GICState *s, int cpu,
> int offset,
> *data = s->h_apr[gic_get_vcpu_real_id(cpu)];
> } else if (gic_cpu_ns_access(s, cpu, attrs)) {
> /* NS view of GICC_APR<n> is the top half of GIC_NSAPR<n> */
> - *data = gic_apr_ns_view(s, regno, cpu);
> + *data = gic_apr_ns_view(s, cpu, regno);
> } else {
> *data = s->apr[regno][cpu];
> }
> @@ -1746,7 +1746,7 @@ static MemTxResult gic_cpu_write(GICState *s, int cpu,
> int offset,
> s->h_apr[gic_get_vcpu_real_id(cpu)] = value;
> } else if (gic_cpu_ns_access(s, cpu, attrs)) {
> /* NS view of GICC_APR<n> is the top half of GIC_NSAPR<n> */
> - gic_apr_write_ns_view(s, regno, cpu, value);
> + gic_apr_write_ns_view(s, cpu, regno, value);
> } else {
> s->apr[regno][cpu] = value;
> }
Ahh C's lack of strong typing wins again :-/
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
--
Alex Bennée
Virtualisation Tech Lead @ Linaro