浏览代码

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 <szymon.janc@tieto.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Szymon Janc 11 年之前
父节点
当前提交
15346a9c28
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      net/bluetooth/rfcomm/core.c

+ 1 - 1
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_ea(b)      ((b & 0x01))
 #define __test_cr(b)      (!!(b & 0x02))
 #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 __addr(cr, dlci)       (((dlci & 0x3f) << 2) | (cr << 1) | 0x01)
 #define __ctrl(type, pf)       (((type & 0xef) | (pf << 4)))
 #define __ctrl(type, pf)       (((type & 0xef) | (pf << 4)))