Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7e2f302a authored by gaurank kathpalia's avatar gaurank kathpalia Committed by Abhishek Singh
Browse files

qcacld-3.0: Use variable size structure to store channel in scan req

Currently the array of scan channel list is of size
SIR_ESE_MAX_MEAS_IE_REQS, but the memory is allocated dynamically
for the channge which can be greater than SIR_ESE_MAX_MEAS_IE_REQS.

So use dynamic array for this as memory is allocated for this every
time.

Change-Id: I3c854b339c49d9f628033aa6742d57568ec14954
CRs-Fixed: 2560184
parent 529497c3
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -925,6 +925,11 @@ typedef struct sSirChannelList {
	uint8_t channelNumber[SIR_ESE_MAX_MEAS_IE_REQS];
} tSirChannelList, *tpSirChannelList;

struct sir_channel_list {
	uint8_t numChannels;
	uint8_t channelNumber[];
};

typedef struct sSirDFSChannelList {
	uint32_t timeStamp[SIR_MAX_24G_5G_CHANNEL_RANGE];

@@ -1058,7 +1063,7 @@ typedef struct sSirSmeScanReq {
	uint32_t oui_field_offset;

	/* channelList MUST be the last field of this structure */
	tSirChannelList channelList;
	struct sir_channel_list channelList;

	/*-----------------------------
	   tSirSmeScanReq....
@@ -4340,7 +4345,7 @@ typedef struct sSirScanOffloadReq {
	uint32_t oui_field_len;
	uint32_t oui_field_offset;

	tSirChannelList channelList;
	struct sir_channel_list channelList;
	/*-----------------------------
	  sSirScanOffloadReq....
	  -----------------------------
+3 −2
Original line number Diff line number Diff line
/*
 * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
 *
 * Permission to use, copy, modify, and/or distribute this software for
 * any purpose with or without fee is hereby granted, provided that the
@@ -670,7 +670,8 @@ QDF_STATUS lim_send_preauth_scan_offload(tpAniSirGlobal mac_ctx,
	tSirRetStatus rc = eSIR_SUCCESS;
	tSirMsgQ msg;

	scan_offload_req = qdf_mem_malloc(sizeof(tSirScanOffloadReq));
	scan_offload_req = qdf_mem_malloc(sizeof(tSirScanOffloadReq) +
					  sizeof(uint8_t));
	if (NULL == scan_offload_req) {
		pe_err("Memory allocation failed for pScanOffloadReq");
		return QDF_STATUS_E_NOMEM;
+2 −1
Original line number Diff line number Diff line
@@ -79,7 +79,8 @@ static QDF_STATUS lim_send_hal_req_remain_on_chan_offload(tpAniSirGlobal pMac,
		return QDF_STATUS_E_INVAL;
	}

	pScanOffloadReq = qdf_mem_malloc(sizeof(tSirScanOffloadReq));
	pScanOffloadReq = qdf_mem_malloc(sizeof(tSirScanOffloadReq) +
					 sizeof(uint8_t));
	if (NULL == pScanOffloadReq) {
		pe_err("Memory allocation failed for pScanOffloadReq");
		return QDF_STATUS_E_NOMEM;
+2 −6
Original line number Diff line number Diff line
@@ -1215,12 +1215,8 @@ static QDF_STATUS lim_send_hal_start_scan_offload_req(tpAniSirGlobal pMac,
	    pe_debug("No IEs in the scan request from supplicant");
	}

	/**
	 * The tSirScanOffloadReq will reserve the space for first channel,
	 * so allocate the memory for (numChannels - 1) and uIEFieldLen
	 */
	len = sizeof(tSirScanOffloadReq) +
		(pScanReq->channelList.numChannels - 1) +
		(pScanReq->channelList.numChannels) +
		pScanReq->uIEFieldLen + pScanReq->oui_field_len;

	pScanOffloadReq = qdf_mem_malloc(len);
@@ -1328,7 +1324,7 @@ static QDF_STATUS lim_send_hal_start_scan_offload_req(tpAniSirGlobal pMac,
			     pScanReq->probe_req_ie_bitmap,
			     PROBE_REQ_BITMAP_LEN * sizeof(uint32_t));
	pScanOffloadReq->oui_field_offset = sizeof(tSirScanOffloadReq) +
				(pScanOffloadReq->channelList.numChannels - 1) +
				(pScanOffloadReq->channelList.numChannels) +
				pScanOffloadReq->uIEFieldLen;
	if (pScanOffloadReq->num_vendor_oui != 0) {
		qdf_mem_copy(
+6 −12
Original line number Diff line number Diff line
@@ -5877,10 +5877,8 @@ static void csr_populate_ie_whitelist_attrs(tSirSmeScanReq *msg,
	qdf_mem_copy(msg->probe_req_ie_bitmap, scan_req->probe_req_ie_bitmap,
		     PROBE_REQ_BITMAP_LEN * sizeof(uint32_t));
	msg->oui_field_len = scan_req->num_vendor_oui * sizeof(*scan_req->voui);
	msg->oui_field_offset = (sizeof(tSirSmeScanReq) -
				 sizeof(msg->channelList.channelNumber) +
				 (sizeof(msg->channelList.channelNumber) *
				 scan_req->ChannelInfo.numOfChannels)) +
	msg->oui_field_offset = (sizeof(tSirSmeScanReq) +
				 (scan_req->ChannelInfo.numOfChannels)) +
				 scan_req->uIEFieldLen;

	if (scan_req->num_vendor_oui != 0)
@@ -5901,10 +5899,8 @@ static QDF_STATUS csr_send_mb_scan_req(tpAniSirGlobal pMac, uint16_t sessionId,
	uint32_t i;
	struct qdf_mac_addr selfmac;

	msgLen = (uint16_t) (sizeof(tSirSmeScanReq) -
		 sizeof(pMsg->channelList.channelNumber) +
		 (sizeof(pMsg->channelList.channelNumber) *
		 pScanReq->ChannelInfo.numOfChannels)) +
	msgLen = (uint16_t) (sizeof(tSirSmeScanReq) +
		 (pScanReq->ChannelInfo.numOfChannels)) +
		 (pScanReq->uIEFieldLen) +
		 pScanReq->num_vendor_oui * sizeof(*pScanReq->voui);

@@ -6058,10 +6054,8 @@ static QDF_STATUS csr_send_mb_scan_req(tpAniSirGlobal pMac, uint16_t sessionId,
	}

	pMsg->uIEFieldLen = (uint16_t) pScanReq->uIEFieldLen;
	pMsg->uIEFieldOffset = (uint16_t) (sizeof(tSirSmeScanReq) -
			sizeof(pMsg->channelList.channelNumber) +
			(sizeof(pMsg->channelList.channelNumber) *
			 pScanReq->ChannelInfo.numOfChannels));
	pMsg->uIEFieldOffset = (uint16_t) (sizeof(tSirSmeScanReq) +
					(pMsg->channelList.numChannels));
	if (pScanReq->uIEFieldLen != 0) {
		qdf_mem_copy((uint8_t *) pMsg + pMsg->uIEFieldOffset,
			     pScanReq->pIEField, pScanReq->uIEFieldLen);