Re: [PATCH v2] irqchip/gic-v3-its: Fix double free on error
From: Marc Zyngier
Date: Thu Apr 11 2024 - 09:01:02 EST
On Thu, 11 Apr 2024 12:58:05 +0100,
Guanrui Huang <guanrui.huang@xxxxxxxxxxxxxxxxx> wrote:
>
> if (vm != domain->host_data)
>
> This is just a safety check. It looks unlikely happened.
It's not a safety check. It is just papering over problems. If you
don't trust the vm pointer, why do you trust the domain pointer? Why
do you trust *anything* at all?
> After all, vm is obtained from the args. If the caller has a bug,
> can we check here to avoid possible problems that may arise in later
> code?
If the caller has a bug, please fix the caller. Don't paper over it.
And you can remove the BUG_ON(!vm) which is equally useless.
Thanks,
M.
--
Without deviation from the norm, progress is not possible.