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:
 <DB9PR04MB8185F2E41D1BC2C590B3E5B3EC592@DB9PR04MB8185.eurprd04.prod.outlook.com>
Date: Tue, 27 Feb 2024 13:54:08 +0000
From: "Madalin Bucur (OSS)" <madalin.bucur@....nxp.com>
To: Markus Elfring <Markus.Elfring@....de>, "netdev@...r.kernel.org"
	<netdev@...r.kernel.org>, "kernel-janitors@...r.kernel.org"
	<kernel-janitors@...r.kernel.org>, "David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo
 Abeni <pabeni@...hat.com>, Sean Anderson <sean.anderson@...o.com>
CC: LKML <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] net: fman: Use common error handling code in dtsec_init()

> -----Original Message-----
> From: Markus Elfring <Markus.Elfring@....de>
> Sent: Tuesday, February 27, 2024 3:15 PM
> To: netdev@...r.kernel.org; kernel-janitors@...r.kernel.org; David S. Miller
> <davem@...emloft.net>; Eric Dumazet <edumazet@...gle.com>; Jakub
> Kicinski <kuba@...nel.org>; Madalin Bucur <madalin.bucur@....com>; Paolo
> Abeni <pabeni@...hat.com>; Sean Anderson <sean.anderson@...o.com>
> Cc: LKML <linux-kernel@...r.kernel.org>
> Subject: [PATCH] net: fman: Use common error handling code in dtsec_init()
> 
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Tue, 27 Feb 2024 14:05:25 +0100
> 
> Adjust jump targets so that a bit of exception handling can be better
> reused at the end of this function implementation.
> 
> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
> ---
>  .../net/ethernet/freescale/fman/fman_dtsec.c  | 19 +++++++++++--------
>  1 file changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/ethernet/freescale/fman/fman_dtsec.c
> b/drivers/net/ethernet/freescale/fman/fman_dtsec.c
> index 3088da7adf0f..1de22400fd89 100644
> --- a/drivers/net/ethernet/freescale/fman/fman_dtsec.c
> +++ b/drivers/net/ethernet/freescale/fman/fman_dtsec.c
> @@ -1279,9 +1279,8 @@ static int dtsec_init(struct fman_mac *dtsec)
>  		   dtsec->max_speed, dtsec->addr, dtsec->exceptions,
>  		   dtsec->tbidev->addr);
>  	if (err) {
> -		free_init_resources(dtsec);
>  		pr_err("DTSEC version doesn't support this i/f mode\n");
> -		return err;
> +		goto free_resources;
>  	}
> 
>  	/* Configure the TBI PHY Control Register */
> @@ -1296,23 +1295,21 @@ static int dtsec_init(struct fman_mac *dtsec)
>  	err = fman_set_mac_max_frame(dtsec->fm, dtsec->mac_id,
> max_frm_ln);
>  	if (err) {
>  		pr_err("Setting max frame length failed\n");
> -		free_init_resources(dtsec);
> -		return -EINVAL;
> +		err = -EINVAL;
> +		goto free_resources;
>  	}
> 
>  	dtsec->multicast_addr_hash =
>  	alloc_hash_table(EXTENDED_HASH_TABLE_SIZE);
>  	if (!dtsec->multicast_addr_hash) {
> -		free_init_resources(dtsec);
>  		pr_err("MC hash table is failed\n");
> -		return -ENOMEM;
> +		goto e_nomem;
>  	}
> 
>  	dtsec->unicast_addr_hash =
> alloc_hash_table(DTSEC_HASH_TABLE_SIZE);
>  	if (!dtsec->unicast_addr_hash) {
> -		free_init_resources(dtsec);
>  		pr_err("UC hash table is failed\n");
> -		return -ENOMEM;
> +		goto e_nomem;
>  	}
> 
>  	/* register err intr handler for dtsec to FPM (err) */
> @@ -1326,6 +1323,12 @@ static int dtsec_init(struct fman_mac *dtsec)
>  	dtsec->dtsec_drv_param = NULL;
> 
>  	return 0;
> +
> +e_nomem:
> +	err = -ENOMEM;
> +free_resources:
> +	free_init_resources(dtsec);
> +	return err;
>  }
> 
>  static int dtsec_free(struct fman_mac *dtsec)
> --
> 2.43.2

Looks good

Acked-by: Madalin Bucur <madalin.bucur@....nxp.com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ