[PATCH] hw/intc/grlib_irqmp: abort realize when ncpus value is out of range

Clément Chigot posted 1 patch 1 month, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20240308152719.591232-1-chigot@adacore.com
Maintainers: "Clément Chigot" <chigot@adacore.com>, Frederic Konrad <konrad.frederic@yahoo.fr>
hw/intc/grlib_irqmp.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] hw/intc/grlib_irqmp: abort realize when ncpus value is out of range
Posted by Clément Chigot 1 month, 2 weeks ago
Even if the error is set, the build is not aborted when the ncpus value
is wrong, the return is missing.

Signed-off-by: Clément Chigot <chigot@adacore.com>
---
 hw/intc/grlib_irqmp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/intc/grlib_irqmp.c b/hw/intc/grlib_irqmp.c
index 144b121d48..c6c51a349c 100644
--- a/hw/intc/grlib_irqmp.c
+++ b/hw/intc/grlib_irqmp.c
@@ -356,6 +356,7 @@ static void grlib_irqmp_realize(DeviceState *dev, Error **errp)
         error_setg(errp, "Invalid ncpus properties: "
                    "%u, must be 0 < ncpus =< %u.", irqmp->ncpus,
                    IRQMP_MAX_CPU);
+        return;
     }
 
     qdev_init_gpio_in(dev, grlib_irqmp_set_irq, MAX_PILS);
-- 
2.25.1


Re: [PATCH] hw/intc/grlib_irqmp: abort realize when ncpus value is out of range
Posted by Philippe Mathieu-Daudé 1 month, 2 weeks ago
On 8/3/24 16:27, Clément Chigot wrote:
> Even if the error is set, the build is not aborted when the ncpus value
> is wrong, the return is missing.
> 
> Signed-off-by: Clément Chigot <chigot@adacore.com>
> ---
>   hw/intc/grlib_irqmp.c | 1 +
>   1 file changed, 1 insertion(+)

Fixes: 6bf1478543 ("hw/intc/grlib_irqmp: add ncpus property")
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Patch queued, thanks!


Re: [PATCH] hw/intc/grlib_irqmp: abort realize when ncpus value is out of range
Posted by Peter Maydell 1 month, 2 weeks ago
On Fri, 8 Mar 2024 at 15:27, Clément Chigot <chigot@adacore.com> wrote:
>
> Even if the error is set, the build is not aborted when the ncpus value
> is wrong, the return is missing.
>
> Signed-off-by: Clément Chigot <chigot@adacore.com>
> ---
>  hw/intc/grlib_irqmp.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/hw/intc/grlib_irqmp.c b/hw/intc/grlib_irqmp.c
> index 144b121d48..c6c51a349c 100644
> --- a/hw/intc/grlib_irqmp.c
> +++ b/hw/intc/grlib_irqmp.c
> @@ -356,6 +356,7 @@ static void grlib_irqmp_realize(DeviceState *dev, Error **errp)
>          error_setg(errp, "Invalid ncpus properties: "
>                     "%u, must be 0 < ncpus =< %u.", irqmp->ncpus,
>                     IRQMP_MAX_CPU);
> +        return;
>      }
>
>      qdev_init_gpio_in(dev, grlib_irqmp_set_irq, MAX_PILS);

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM