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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fc3fcd69-8d6e-4758-4e0b-16a52b764680@amd.com>
Date: Wed, 7 Aug 2024 09:07:51 -0700
From: Lizhi Hou <lizhi.hou@....com>
To: Markus Elfring <Markus.Elfring@....de>, <dri-devel@...ts.freedesktop.org>,
	Oded Gabbay <ogabbay@...nel.org>
CC: LKML <linux-kernel@...r.kernel.org>, George Yang <George.Yang@....com>,
	<king.tam@....com>, Max Zhen <max.zhen@....com>, Min Ma <min.ma@....com>,
	Narendra Gutta <VenkataNarendraKumar.Gutta@....com>, Sonal Santan
	<sonal.santan@....com>
Subject: Re: [PATCH V2 01/10] accel/amdxdna: Add a new driver for AMD AI
 Engine


On 8/7/24 04:06, Markus Elfring wrote:
> If you temporarily find the circumstances too challenging for applications
> of scope-based resource management, I suggest to use the following statements instead
> (so that a bit of redundant code can be avoided).
>
>
>
> …
>> +++ b/drivers/accel/amdxdna/aie2_pci.c
>> @@ -0,0 +1,182 @@
> …
>> +static int aie2_init(struct amdxdna_dev *xdna)
>> +{
> …
>> +	release_firmware(fw);
>> +	return 0;
> 	ret = 0;
> 	goto release_fw;

I believe compiler will do the optimization. And I prefer current code 
which only error branch jumps to the corresponding cleanup.


Thanks,

Lizhi

>
> …
>> +release_fw:
>> +	release_firmware(fw);
>> +
>> +	return ret;
>> +}
> …
>
>
> Otherwise (in case further collateral evolution will become more desirable):
> …
>> +static int aie2_init(struct amdxdna_dev *xdna)
>> +{
> …
>> +	const struct firmware *fw;
> I propose to take another software design option better into account.
>
> * You may reduce the scope of such a local variable.
>
> * How do you think about to use the attribute “__free(firmware)”?
>    https://elixir.bootlin.com/linux/v6.11-rc2/source/include/linux/firmware.h#L214
>
> …
>> +	ret = request_firmware(&fw, ndev->priv->fw_path, &pdev->dev);
> …
>
>
> Regards,
> Markus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ