qcacmn: Add NULL check for HIF state and CE state before dereferencing

Add NULL check for HIF state and CE state in ce_send_cb_register and
ce_recv_cb_register functions before dereferencing it.

Change-Id: I96cde91775ff77f6ae863b4d56e48c42e34104c7
CRs-Fixed: 1081995
This commit is contained in:
Poddar, Siddarth 2016-10-25 17:16:38 +05:30 • committed by qcabuildsw
commit fbb155f557

View file

@ -2246,13 +2246,19 @@ ce_send_cb_register(struct CE_handle *copyeng,
void *ce_send_context, int disable_interrupts)
{
struct CE_state *CE_state = (struct CE_state *)copyeng;
struct hif_softc *scn = CE_state->scn;
struct HIF_CE_state *hif_state = HIF_GET_CE_STATE(scn);
struct hif_softc *scn;
struct HIF_CE_state *hif_state;
if (CE_state == NULL) {
HIF_ERROR("%s: Error CE state = NULL", __func__);
return;
}
scn = CE_state->scn;
hif_state = HIF_GET_CE_STATE(scn);
if (hif_state == NULL) {
HIF_ERROR("%s: Error HIF state = NULL", __func__);
return;
}
CE_state->send_context = ce_send_context;
CE_state->send_cb = fn_ptr;
hif_state->ce_services->ce_per_engine_handler_adjust(CE_state,
@ -2277,13 +2283,19 @@ ce_recv_cb_register(struct CE_handle *copyeng,
void *CE_recv_context, int disable_interrupts)
{
struct CE_state *CE_state = (struct CE_state *)copyeng;
struct hif_softc *scn = CE_state->scn;
struct HIF_CE_state *hif_state = HIF_GET_CE_STATE(scn);
struct hif_softc *scn;
struct HIF_CE_state *hif_state;
if (CE_state == NULL) {
HIF_ERROR("%s: ERROR CE state = NULL", __func__);
return;
}
scn = CE_state->scn;
hif_state = HIF_GET_CE_STATE(scn);
if (hif_state == NULL) {
HIF_ERROR("%s: Error HIF state = NULL", __func__);
return;
}
CE_state->recv_context = CE_recv_context;
CE_state->recv_cb = fn_ptr;
hif_state->ce_services->ce_per_engine_handler_adjust(CE_state,