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: <112f5047-5a5e-42cc-90b5-f9c2711fa5db@amd.com>
Date: Tue, 2 Jan 2024 10:47:12 -0600
From: Tom Lendacky <thomas.lendacky@....com>
To: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
 "Borislav Petkov (AMD)" <bp@...en8.de>,
 Dan Williams <dan.j.williams@...el.com>,
 Dionna Glaze <dionnaglaze@...gle.com>
Cc: kernel@...gutronix.de, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] virt: sev-guest: Convert to platform remove callback
 returning void

On 12/26/23 07:28, Uwe Kleine-König wrote:
> The .remove() callback for a platform driver returns an int which makes
> many driver authors wrongly assume it's possible to do error handling by
> returning an error code. However the value returned is ignored (apart
> from emitting a warning) and this typically results in resource leaks.
> 
> To improve here there is a quest to make the remove callback return
> void. In the first step of this quest all drivers are converted to
> .remove_new(), which already returns void. Eventually after all drivers
> are converted, .remove_new() will be renamed to .remove().
> 
> Trivially convert this driver from always returning zero in the remove
> callback to the void returning variant.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>

Acked-by: Tom Lendacky <thomas.lendacky@....com>

> ---
>   drivers/virt/coco/sev-guest/sev-guest.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/virt/coco/sev-guest/sev-guest.c b/drivers/virt/coco/sev-guest/sev-guest.c
> index bc564adcf499..87f241825bc3 100644
> --- a/drivers/virt/coco/sev-guest/sev-guest.c
> +++ b/drivers/virt/coco/sev-guest/sev-guest.c
> @@ -994,7 +994,7 @@ static int __init sev_guest_probe(struct platform_device *pdev)
>   	return ret;
>   }
>   
> -static int __exit sev_guest_remove(struct platform_device *pdev)
> +static void __exit sev_guest_remove(struct platform_device *pdev)
>   {
>   	struct snp_guest_dev *snp_dev = platform_get_drvdata(pdev);
>   
> @@ -1003,8 +1003,6 @@ static int __exit sev_guest_remove(struct platform_device *pdev)
>   	free_shared_pages(snp_dev->request, sizeof(struct snp_guest_msg));
>   	deinit_crypto(snp_dev->crypto);
>   	misc_deregister(&snp_dev->misc);
> -
> -	return 0;
>   }
>   
>   /*
> @@ -1013,7 +1011,7 @@ static int __exit sev_guest_remove(struct platform_device *pdev)
>    * with the SEV-SNP support, it is named "sev-guest".
>    */
>   static struct platform_driver sev_guest_driver = {
> -	.remove		= __exit_p(sev_guest_remove),
> +	.remove_new	= __exit_p(sev_guest_remove),
>   	.driver		= {
>   		.name = "sev-guest",
>   	},

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ