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]
Date: Sun, 19 May 2024 15:18:52 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: Siddharth Vadapalli <s-vadapalli@...com>, netdev@...r.kernel.org,
 linux-arm-kernel@...ts.infradead.org, kernel-janitors@...r.kernel.org,
 "David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
 Jakub Kicinski <kuba@...nel.org>, Jonathan Corbet <corbet@....net>,
 MD Danish Anwar <danishanwar@...com>, Paolo Abeni <pabeni@...hat.com>,
 Roger Quadros <rogerq@...nel.org>, Vladimir Oltean <vladimir.oltean@....com>
Cc: LKML <linux-kernel@...r.kernel.org>, linux-doc@...r.kernel.org,
 Misael Lopez Cruz <misael.lopez@...com>, Sriramakrishnan <srk@...com>,
 Vignesh Raghavendra <vigneshr@...com>
Subject: Re: [RFC PATCH net-next 12/28] net: ethernet: ti: cpsw-proxy-client:
 add NAPI RX polling function

…
> +++ b/drivers/net/ethernet/ti/cpsw-proxy-client.c
…
> @@ -988,6 +994,189 @@ static int vport_tx_poll(struct napi_struct *napi_tx, int budget)
…
> +static int vport_rx_packets(struct virtual_port *vport, u32 rx_chan_idx)
> +{
…
> +	if (unlikely(!netif_running(skb->dev))) {
> +		dev_kfree_skb_any(skb);
> +		return -ENODEV;
> +	}

I suggest to move such exception handling to the end of this function implementation
so that it can be better reused also by another if branch.
https://wiki.sei.cmu.edu/confluence/display/c/MEM12-C.+Consider+using+a+goto+chain+when+leaving+a+function+on+error+when+using+and+releasing+resources

How do you think about to increase the application of scope-based resource management
also for such a software component?
https://elixir.bootlin.com/linux/v6.9.1/source/include/linux/cleanup.h

Regards,
Markus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ