From: Szymon Janc Date: Mon, 13 Oct 2014 09:43:54 +0000 (+0200) Subject: Bluetooth: Improve RFCOMM __test_pf macro robustness X-Git-Tag: v3.19-rc1~118^2~234^2~3^2~111 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=15346a9c2875cae8e84c13196a2fc7428d9358d4;p=karo-tx-linux.git Bluetooth: Improve RFCOMM __test_pf macro robustness Value returned by this macro might be used as bit value so it should return either 0 or 1 to avoid possible bugs (similar to NSC bug) when shifting it. Signed-off-by: Szymon Janc Signed-off-by: Johan Hedberg --- diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index d0bbc737f162..bce9c3d39324 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c @@ -79,7 +79,7 @@ static struct rfcomm_session *rfcomm_session_del(struct rfcomm_session *s); #define __test_ea(b) ((b & 0x01)) #define __test_cr(b) (!!(b & 0x02)) -#define __test_pf(b) ((b & 0x10)) +#define __test_pf(b) (!!(b & 0x10)) #define __addr(cr, dlci) (((dlci & 0x3f) << 2) | (cr << 1) | 0x01) #define __ctrl(type, pf) (((type & 0xef) | (pf << 4)))