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:	Tue, 22 Jul 2014 09:10:06 +0000
From:	David Laight <David.Laight@...LAB.COM>
To:	'Sonic Zhang' <sonic.adi@...il.com>,
	David Miller <davem@...emloft.net>
CC:	Eric Dumazet <eric.dumazet@...il.com>,
	netdev <netdev@...r.kernel.org>,
	Francois Romieu <romieu@...zoreil.com>,
	"adi-buildroot-devel@...ts.sourceforge.net" 
	<adi-buildroot-devel@...ts.sourceforge.net>,
	"Zhang, Sonic" <sonic.zhang@...log.com>
Subject: RE: [PATCH v7] bfin_mac: convert bfin Ethernet driver to NAPI
 framework

From: Sonic Zhang
...
> if (!--A)
> 
> doesn't equal to
> 
> if (A--)
>         if (!A)
> 
> In net poll loop, because of NAPI state bit NAPI_STATE_NPSVC, the napi
> poll callback may be called with A = 0 (MAC RX IRQ is enabled) if
> napi_complete() other than __napi_complete() is used. See the
> explanation in my last email.
> 
> In this case, the up condition decreases A to a negative number and
> the interrupt handler condition "if (!A++)" can never increase A back
> to 0 (disable the RX IRQ). While, the down condition only decreases A
> if it is not 0.

The logic doesn't matter, the C is equivalent - the compiler probably
generates the same code.
The only time they might be different is if 'A' is volatile.
Well, apart from the non-deterministic cases where other code is
modifying the variable at the same time - and you are at the whim
of the compiler.

	David

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ