This fixes a case where logical '||' was used with constant operand
and the condition check always resulted in true.
Was: if (type == BTDEV_TYPE_BREDRLE || type == BTDEV_TYPE_LE
|| BTDEV_TYPE_BREDRLE50)
Fixed: if (type == BTDEV_TYPE_BREDRLE || type == BTDEV_TYPE_LE
|| type == BTDEV_TYPE_BREDRLE50)
---
emulator/btdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/emulator/btdev.c b/emulator/btdev.c
index f4c79c2d0..38d5b3b1f 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -645,7 +645,7 @@ struct btdev *btdev_create(enum btdev_type type, uint16_t id)
memset(btdev, 0, sizeof(*btdev));
if (type == BTDEV_TYPE_BREDRLE || type == BTDEV_TYPE_LE
- || BTDEV_TYPE_BREDRLE50) {
+ || type == BTDEV_TYPE_BREDRLE50) {
btdev->crypto = bt_crypto_new();
if (!btdev->crypto) {
free(btdev);
--
2.21.0
Applied.
On Thu, 2019-07-04 at 00:01 -0700, Inga Stotland wrote:
> This fixes a case where logical '||' was used with constant operand
> and the condition check always resulted in true.
>
> Was: if (type == BTDEV_TYPE_BREDRLE || type == BTDEV_TYPE_LE
> || BTDEV_TYPE_BREDRLE50)
> Fixed: if (type == BTDEV_TYPE_BREDRLE || type == BTDEV_TYPE_LE
> || type ==
> BTDEV_TYPE_BREDRLE50)
> ---
> emulator/btdev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/emulator/btdev.c b/emulator/btdev.c
> index f4c79c2d0..38d5b3b1f 100644
> --- a/emulator/btdev.c
> +++ b/emulator/btdev.c
> @@ -645,7 +645,7 @@ struct btdev *btdev_create(enum btdev_type type,
> uint16_t id)
> memset(btdev, 0, sizeof(*btdev));
>
> if (type == BTDEV_TYPE_BREDRLE || type == BTDEV_TYPE_LE
> - || BTDEV_TYPE_BREDRLE50) {
> + || type == BTDEV_TYPE_BREDRLE50) {
> btdev->crypto = bt_crypto_new();
> if (!btdev->crypto) {
> free(btdev);