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: <52BABA23.2040709@cogentembedded.com>
Date:	Wed, 25 Dec 2013 14:57:39 +0400
From:	Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To:	Ding Tianhong <dingtianhong@...wei.com>,
	Mauro Carvalho Chehab <m.chehab@...sung.com>,
	linux-media@...r.kernel.org,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Netdev <netdev@...r.kernel.org>
Subject: Re: [PATCH v3 13/19] media: dvb_core: slight optimization of addr
 compare

Hello.

On 25-12-2013 7:29, Ding Tianhong wrote:

> Use possibly more efficient ether_addr_equal
> instead of memcmp.

> Cc: Mauro Carvalho Chehab <m.chehab@...sung.com>
> Cc: linux-media@...r.kernel.org
> Cc: linux-kernel@...r.kernel.org
> Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
> Signed-off-by: Ding Tianhong <dingtianhong@...wei.com>
> ---
>   drivers/media/dvb-core/dvb_net.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)

> diff --git a/drivers/media/dvb-core/dvb_net.c b/drivers/media/dvb-core/dvb_net.c
> index f91c80c..3dfc33b 100644
> --- a/drivers/media/dvb-core/dvb_net.c
> +++ b/drivers/media/dvb-core/dvb_net.c
> @@ -179,7 +179,7 @@ static __be16 dvb_net_eth_type_trans(struct sk_buff *skb,
>   	eth = eth_hdr(skb);
>
>   	if (*eth->h_dest & 1) {
> -		if(memcmp(eth->h_dest,dev->broadcast, ETH_ALEN)==0)
> +		if(ether_addr_equal(eth->h_dest,dev->broadcast))

    There should be space after comma.

> @@ -674,11 +674,11 @@ static void dvb_net_ule( struct net_device *dev, const u8 *buf, size_t buf_len )
>   					if (priv->rx_mode != RX_MODE_PROMISC) {
>   						if (priv->ule_skb->data[0] & 0x01) {
>   							/* multicast or broadcast */
> -							if (memcmp(priv->ule_skb->data, bc_addr, ETH_ALEN)) {
> +							if (!ether_addr_equal(priv->ule_skb->data, bc_addr)) {
>   								/* multicast */
>   								if (priv->rx_mode == RX_MODE_MULTI) {
>   									int i;
> -									for(i = 0; i < priv->multi_num && memcmp(priv->ule_skb->data, priv->multi_macs[i], ETH_ALEN); i++)
> +									for(i = 0; i < priv->multi_num && !ether_addr_equal(priv->ule_skb->data, priv->multi_macs[i]); i++)

    Shouldn't this line be broken?

>   										;
>   									if (i == priv->multi_num)
>   										drop = 1;

WBR, Sergei


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ