Commit 1919b056 authored by Colin Ian King's avatar Colin Ian King Committed by Greg Kroah-Hartman

staging: r8822be: fix null pointer dereference with a null driver_adapter

The call to _rtl_dbg_trace via macro HALMAC_RT_TRACE will trigger a null
pointer deference on the null driver_adapter.  Fix this by assigning
driver_adapter earlier to halmac_adapter->driver_adapter before the tracing
call so that a non-null driver_adapter is passed instead.

Detected by CoverityScan, CID#1454613 ("Explicit null dereferenced")

Fixes: 938a0447 ("staging: r8822be: Add code for halmac sub-driver")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Acked-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2ffabf50
...@@ -4447,7 +4447,7 @@ halmac_func_p2pps_88xx(struct halmac_adapter *halmac_adapter, ...@@ -4447,7 +4447,7 @@ halmac_func_p2pps_88xx(struct halmac_adapter *halmac_adapter,
{ {
u8 h2c_buff[HALMAC_H2C_CMD_SIZE_88XX] = {0}; u8 h2c_buff[HALMAC_H2C_CMD_SIZE_88XX] = {0};
u16 h2c_seq_mum = 0; u16 h2c_seq_mum = 0;
void *driver_adapter = NULL; void *driver_adapter = halmac_adapter->driver_adapter;
struct halmac_api *halmac_api; struct halmac_api *halmac_api;
struct halmac_h2c_header_info h2c_header_info; struct halmac_h2c_header_info h2c_header_info;
enum halmac_ret_status status = HALMAC_RET_SUCCESS; enum halmac_ret_status status = HALMAC_RET_SUCCESS;
...@@ -4455,7 +4455,6 @@ halmac_func_p2pps_88xx(struct halmac_adapter *halmac_adapter, ...@@ -4455,7 +4455,6 @@ halmac_func_p2pps_88xx(struct halmac_adapter *halmac_adapter,
HALMAC_RT_TRACE(driver_adapter, HALMAC_MSG_H2C, DBG_DMESG, HALMAC_RT_TRACE(driver_adapter, HALMAC_MSG_H2C, DBG_DMESG,
"[TRACE]halmac_p2pps !!\n"); "[TRACE]halmac_p2pps !!\n");
driver_adapter = halmac_adapter->driver_adapter;
halmac_api = (struct halmac_api *)halmac_adapter->halmac_api; halmac_api = (struct halmac_api *)halmac_adapter->halmac_api;
P2PPS_SET_OFFLOAD_EN(h2c_buff, p2p_ps->offload_en); P2PPS_SET_OFFLOAD_EN(h2c_buff, p2p_ps->offload_en);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment