lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240115133756.674ae019.alex.williamson@redhat.com>
Date: Mon, 15 Jan 2024 13:37:56 -0700
From: Alex Williamson <alex.williamson@...hat.com>
To: Markus Elfring <Markus.Elfring@....de>
Cc: kvm@...r.kernel.org, kernel-janitors@...r.kernel.org, Eric Auger
 <eric.auger@...hat.com>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] vfio/platform: Use common error handling code in
 vfio_set_trigger()

On Mon, 15 Jan 2024 18:16:01 +0100
Markus Elfring <Markus.Elfring@....de> wrote:

> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Mon, 15 Jan 2024 18:08:29 +0100
> 
> Add a jump target so that a bit of exception handling can be better reused
> in an if branch of this function.
> 
> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
> ---
>  drivers/vfio/platform/vfio_platform_irq.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/vfio/platform/vfio_platform_irq.c b/drivers/vfio/platform/vfio_platform_irq.c
> index 61a1bfb68ac7..8604ce4f3fee 100644
> --- a/drivers/vfio/platform/vfio_platform_irq.c
> +++ b/drivers/vfio/platform/vfio_platform_irq.c
> @@ -193,8 +193,8 @@ static int vfio_set_trigger(struct vfio_platform_device *vdev, int index,
> 
>  	trigger = eventfd_ctx_fdget(fd);
>  	if (IS_ERR(trigger)) {
> -		kfree(irq->name);
> -		return PTR_ERR(trigger);
> +		ret = PTR_ERR(trigger);
> +		goto free_name;
>  	}
> 
>  	irq->trigger = trigger;
> @@ -202,9 +202,10 @@ static int vfio_set_trigger(struct vfio_platform_device *vdev, int index,
>  	irq_set_status_flags(irq->hwirq, IRQ_NOAUTOEN);
>  	ret = request_irq(irq->hwirq, handler, 0, irq->name, irq);
>  	if (ret) {
> -		kfree(irq->name);
>  		eventfd_ctx_put(trigger);
>  		irq->trigger = NULL;
> +free_name:
> +		kfree(irq->name);
>  		return ret;
>  	}
> 

TBH, this doesn't seem like a worthwhile exit point consolidation.  A
change like this might be justified if there were some common unlock
code that could be shared, but for a simple free and return errno by
jumping to a different exception block, rather than even a common exit
block, I don't see the value.  Thanks,

Alex


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ