Browse Source

qcacmn: Fix crash due to corruption in ce_mark_datapath

Use length of service_to_pipe array to loop through services instead of
array size.

Change-Id: I107203861501ed5ac348979868ac981b5a6cd1ae
CRs-Fixed: 2033254
Kiran Venkatappa 8 years ago
parent
commit
c068709444
1 changed files with 3 additions and 2 deletions
  1. 3 2
      hif/src/ce/ce_main.c

+ 3 - 2
hif/src/ce/ce_main.c

@@ -597,7 +597,7 @@ static void hif_select_service_to_pipe_map(struct hif_softc *scn,
 static bool ce_mark_datapath(struct CE_state *ce_state)
 {
 	struct service_to_pipe *svc_map;
-	uint32_t map_sz;
+	uint32_t map_sz, map_len;
 	int    i;
 	bool   rc = false;
 
@@ -605,7 +605,8 @@ static bool ce_mark_datapath(struct CE_state *ce_state)
 		hif_select_service_to_pipe_map(ce_state->scn, &svc_map,
 					       &map_sz);
 
-		for (i = 0; i < map_sz; i++) {
+		map_len = map_sz / sizeof(struct service_to_pipe);
+		for (i = 0; i < map_len; i++) {
 			if ((svc_map[i].pipenum == ce_state->id) &&
 			    ((svc_map[i].service_id == HTT_DATA_MSG_SVC)  ||
 			     (svc_map[i].service_id == HTT_DATA2_MSG_SVC) ||