summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRajeev Kumar <rajekuma@codeaurora.org>2016-07-27 14:44:01 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2016-08-03 18:57:10 -0700
commit348ed99339ef7e00d4902abfae710137ba992f55 (patch)
tree8c13a47bc70fcc049a0f2a9a8caf11e43992e277
parente5a1682c3e90b56b3c235b9343f248c02715a734 (diff)
qcacld-3.0: Add memory allocation failure check for BPF instructions
Add check for BPF instructions memory allocation failure and fail the request gracefully if memory allocation fails. Change-Id: Ifa6cab73c59aa4a7c587fa0b7d38e9b8523a3b1c CRs-Fixed: 1047209
-rw-r--r--core/sme/src/common/sme_api.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c
index 3d410ec47e64..ff6bf940086b 100644
--- a/core/sme/src/common/sme_api.c
+++ b/core/sme/src/common/sme_api.c
@@ -15754,6 +15754,12 @@ QDF_STATUS sme_set_bpf_instructions(tHalHandle hal,
if (set_offload->total_length) {
set_offload->program = qdf_mem_malloc(sizeof(uint8_t) *
req->current_length);
+ if (NULL == set_offload->program) {
+ QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
+ FL("Failed to alloc instruction memory"));
+ qdf_mem_free(set_offload);
+ return QDF_STATUS_E_NOMEM;
+ }
qdf_mem_copy(set_offload->program, req->program,
set_offload->current_length);
}