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: <4986975d.3de3.180b1f57189.Coremail.zhaojunkui2008@126.com>
Date:   Wed, 11 May 2022 15:11:34 +0800 (CST)
From:   z <zhaojunkui2008@....com>
To:     "Marc Kleine-Budde" <mkl@...gutronix.de>
Cc:     "Wolfgang Grandegger" <wg@...ndegger.com>,
        "David S. Miller" <davem@...emloft.net>,
        "Jakub Kicinski" <kuba@...nel.org>,
        "Paolo Abeni" <pabeni@...hat.com>,
        Stefan Mätje <stefan.maetje@....eu>,
        "Vincent Mailhol" <mailhol.vincent@...adoo.fr>,
        linux-can@...r.kernel.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, bernard@...o.com
Subject: Re:Re: [PATCH] usb/peak_usb: cleanup code


At 2022-05-11 14:44:50, "Marc Kleine-Budde" <mkl@...gutronix.de> wrote:
>On 10.05.2022 23:38:38, Bernard Zhao wrote:
>> The variable fi and bi only used in branch if (!dev->prev_siblings)
>> , fi & bi not kmalloc in else branch, so move kfree into branch
>> if (!dev->prev_siblings),this change is to cleanup the code a bit.
>
>Please move the variable declaration into that scope, too. Adjust the
>error handling accordingly.

Hi Marc:

I am not sure if there is some gap.
If we move the variable declaration into that scope, then each error branch has to do the kfree job, like:
if (err) {
			dev_err(dev->netdev->dev.parent,
				"unable to read %s firmware info (err %d)\n",
				pcan_usb_pro.name, err);
	                kfree(bi);
	                kfree(fi);
	                kfree(usb_if);

	               return err;
		}
I am not sure if this looks a little less clear?
Thanks!

BR//Bernard
>
>regards,
>Marc
>
>-- 
>Pengutronix e.K.                 | Marc Kleine-Budde           |
>Embedded Linux                   | https://www.pengutronix.de  |
>Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
>Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ