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] [day] [month] [year] [list]
Message-ID: <AE90C24D6B3A694183C094C60CF0A2F6026B74BD@saturn3.aculab.com>
Date:	Fri, 20 Dec 2013 09:46:59 -0000
From:	"David Laight" <David.Laight@...LAB.COM>
To:	"Joe Perches" <joe@...ches.com>,
	"Florian Fainelli" <f.fainelli@...il.com>
Cc:	<davem@...emloft.net>, <netdev@...r.kernel.org>
Subject: RE: [PATCH net-next 3/9] net: phy: dp83640: fix checkpath error

> From: Joe Perches
> Sent: 19 December 2013 22:31
> On Tue, 2013-12-17 at 21:38 -0800, Florian Fainelli wrote:
> > diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c
> []
> > @@ -851,8 +851,8 @@ static int match(struct sk_buff *skb, unsigned int type, struct rxts *rxts)
> >
> >  	seqid = (u16 *)(data + offset + OFF_PTP_SEQUENCE_ID);
> >
> > -	return (rxts->msgtype == (*msgtype & 0xf) &&
> > -		rxts->seqid   == ntohs(*seqid));
> > +	return rxts->msgtype == (*msgtype & 0xf) &&
> > +		rxts->seqid   == ntohs(*seqid);
> 
> I think this isn't an improvement.
> 
> Maybe:
> 	return rxts->msgtype == (*msgtype & 0xf) &&
> 	       rxts->seqid == ntohs(*seqid);
> or
> 	return (rxts->msgtype == (*msgtype & 0xf)) &&
> 	       (rxts->seqid == ntohs(*seqid));

Or even (modulo stupid errors):
	return !((rxts->msgtype ^ (*msgtype & 0xf))
		  | (rxts->seqid ^ ntohs(*seqid)));
which saves a branch if the conditional is usually true.

	David



--
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