2021-09-09 12:49:51

by Colin King

[permalink] [raw]
Subject: [PATCH] Bluetooth: btintel: Fix incorrect out of memory check

From: Colin Ian King <[email protected]>

Currently *ven_data is being assigned the return from a kmalloc call but
the out-of-memory check is checking ven_data and not *ven_data. Fix this
by adding the missing dereference * operator,

Addresses-Coverity: ("Dereference null return")
Fixes: 70dd978952bc ("Bluetooth: btintel: Define a callback to fetch codec config data")
Signed-off-by: Colin Ian King <[email protected]>
---
drivers/bluetooth/btintel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c
index 115bb2d07a8d..9359bff47296 100644
--- a/drivers/bluetooth/btintel.c
+++ b/drivers/bluetooth/btintel.c
@@ -2176,7 +2176,7 @@ static int btintel_get_codec_config_data(struct hci_dev *hdev,
}

*ven_data = kmalloc(sizeof(__u8), GFP_KERNEL);
- if (!ven_data) {
+ if (!*ven_data) {
err = -ENOMEM;
goto error;
}
--
2.32.0


2021-09-10 07:30:43

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [PATCH] Bluetooth: btintel: Fix incorrect out of memory check

Hi Colin,

> Currently *ven_data is being assigned the return from a kmalloc call but
> the out-of-memory check is checking ven_data and not *ven_data. Fix this
> by adding the missing dereference * operator,
>
> Addresses-Coverity: ("Dereference null return")
> Fixes: 70dd978952bc ("Bluetooth: btintel: Define a callback to fetch codec config data")
> Signed-off-by: Colin Ian King <[email protected]>
> ---
> drivers/bluetooth/btintel.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

patch has been applied to bluetooth-next tree.

Regards

Marcel