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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sat, 16 Jan 2021 18:58:42 -0800
From:   Jakub Kicinski <kuba@...nel.org>
To:     menglong8.dong@...il.com
Cc:     roopa@...dia.com, nikolay@...dia.com, davem@...emloft.net,
        bridge@...ts.linux-foundation.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        Menglong Dong <dong.menglong@....com.cn>
Subject: Re: [PATCH v3 net-next] net: bridge: check vlan with
 eth_type_vlan() method

On Thu, 14 Jan 2021 20:41:31 -0800 menglong8.dong@...il.com wrote:
> -	if (data[IFLA_BR_VLAN_PROTOCOL]) {
> -		switch (nla_get_be16(data[IFLA_BR_VLAN_PROTOCOL])) {
> -		case htons(ETH_P_8021Q):
> -		case htons(ETH_P_8021AD):
> -			break;
> -		default:
> -			return -EPROTONOSUPPORT;
> -		}
> +	if (data[IFLA_BR_VLAN_PROTOCOL] &&
> +	    !eth_type_vlan(nla_get_be16(data[IFLA_BR_VLAN_PROTOCOL]))) {
> +		return -EPROTONOSUPPORT;
>  	}

The curly brackets are no longer necessary here, since it's a single
line expression.

Powered by blists - more mailing lists