On Monday 03 September 2012 23:11:39 Sven Eckelmann wrote:
On Monday 03 September 2012 22:20:31 Linus Lüssing wrote:
On some architectures test_bit() can return other values than 0 or 1:
With a generic x86 OpenWrt image in a kvm setup (batadv_)test_bit() frequently returns -1 for me, leading to batadv_iv_ogm_update_seqnos() wrongly signaling a protected seqno window.
This patch tries to fix this issue by making batadv_test_bit() return 0 or 1 only.
Signed-off-by: Linus Lüssing linus.luessing@web.de
Weird, I couldn't find the code that would cause a -1 here (but I just checked recent kernel versions). Most of them already added the "!= 0" in the function itself. And the both version of the variable_test_bit seem to return 0 and -1 (at least my quick interpretation of the asm listings).
Just checked a asm reference and noticed that I remembered sbb wrong. The calculation behind it is: op2 - (op1 + CF). I thought that it was: op2 - op1 + CF