]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Bluetooth: Improve RFCOMM __test_pf macro robustness
authorSzymon Janc <szymon.janc@tieto.com>
Mon, 13 Oct 2014 09:43:54 +0000 (11:43 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Sat, 25 Oct 2014 05:56:24 +0000 (07:56 +0200)
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 <szymon.janc@tieto.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
net/bluetooth/rfcomm/core.c

index d0bbc737f162789403f437c056fc534fb4538320..bce9c3d393248e882afe309feaf1b6b71b9cd51f 100644 (file)
@@ -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)))