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:   Thu, 17 Sep 2020 15:32:58 +0800
From:   Landen Chao <landen.chao@...iatek.com>
To:     Alex Dewar <alex.dewar90@...il.com>
CC:     Sean Wang <Sean.Wang@...iatek.com>, Andrew Lunn <andrew@...n.ch>,
        "Vivien Didelot" <vivien.didelot@...il.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        "Jakub Kicinski" <kuba@...nel.org>,
        Matthias Brugger <matthias.bgg@...il.com>,
        Russell King <linux@...linux.org.uk>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "linux-mediatek@...ts.infradead.org" 
        <linux-mediatek@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] net: dsa: mt7530: Add some return-value checks

Hi Alex,

Thanks for your review and fixing.
On Thu, 2020-09-17 at 03:50 +0800, Alex Dewar wrote:
[..]
> 
> If it is not expected that these functions will throw errors (i.e.
> because the parameters passed will always be correct), we could dispense
> with the use of EINVAL errors and just use BUG*() macros instead. Let me
> know if you'd rather I fix things up in that way.
The cpu port setting is passed by dts. Use EINVAL to catch unexpected
setting is fine.
> 
> Best,
> Alex
> 
>  drivers/net/dsa/mt7530.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
> index 61388945d316..157d0a01faae 100644
> --- a/drivers/net/dsa/mt7530.c
> +++ b/drivers/net/dsa/mt7530.c
> @@ -945,10 +945,14 @@ static int
>  mt753x_cpu_port_enable(struct dsa_switch *ds, int port)
>  {
>  	struct mt7530_priv *priv = ds->priv;
> +	int ret;
>  
>  	/* Setup max capability of CPU port at first */
> -	if (priv->info->cpu_port_config)
> -		priv->info->cpu_port_config(ds, port);
> +	if (priv->info->cpu_port_config) {
> +		ret = priv->info->cpu_port_config(ds, port);
> +		if (ret)
> +			return ret;
> +	}
How about check return value in caller function, mt7530_setup() and
mt7531_setup(), too?
                if (dsa_is_cpu_port(ds, i)) {
                        ret = mt753x_cpu_port_enable(ds, i);
			if (ret)
				return ret;
		} else {
[..]
regards,
landen

Powered by blists - more mailing lists