summaryrefslogtreecommitdiff
path: root/qcwcn/wifi_hal/wifi_hal.cpp
diff options
context:
space:
mode:
authormazumdar <mazumdar@codeaurora.org>2018-06-19 12:00:00 +0530
committerAhmed ElArabawy <arabawy@google.com>2019-01-17 16:09:54 -0800
commit3e203f431fe6b23857f056e28b82244ebb8101cd (patch)
tree0241cae136b94ea08e9b0739129148a27017bb78 /qcwcn/wifi_hal/wifi_hal.cpp
parent5bc44e7f281521a11656f2d55abbf4f262064195 (diff)
downloadwlan-3e203f431fe6b23857f056e28b82244ebb8101cd.tar.gz
WiFi-HAL: Initialize "wifi_read_packet_filter" return type
In earlier implementation of "wifi_read_packet_filter", there may arise a scenario where return "ret" remain uninitialized if "length" value passed to this function is zero and APF "enable/disable" functionality is carried out by the framework. Make changes, so that return "ret" is initialized at the time of its declaration and a check is added where "length" to be passed to this function is non-zero. Bug: 121109906 Test: Regression Test Change-Id: Ibc8bd164f086f8578b98b83eab3b2884188a4138 CRs-Fixed: 2263409
Diffstat (limited to 'qcwcn/wifi_hal/wifi_hal.cpp')
-rw-r--r--qcwcn/wifi_hal/wifi_hal.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/qcwcn/wifi_hal/wifi_hal.cpp b/qcwcn/wifi_hal/wifi_hal.cpp
index 15dec42..315c814 100644
--- a/qcwcn/wifi_hal/wifi_hal.cpp
+++ b/qcwcn/wifi_hal/wifi_hal.cpp
@@ -1786,13 +1786,19 @@ cleanup:
static wifi_error wifi_read_packet_filter(wifi_interface_handle handle,
u32 src_offset, u8 *host_dst, u32 length)
{
- wifi_error ret;
+ wifi_error ret = WIFI_SUCCESS;
struct nlattr *nlData;
WifihalGeneric *vCommand = NULL;
interface_info *ifaceInfo = getIfaceInfo(handle);
wifi_handle wifiHandle = getWifiHandle(handle);
hal_info *info = getHalInfo(wifiHandle);
+ /* Length to be passed to this function should be non-zero
+ * Return invalid argument if length is passed as zero
+ */
+ if (length == 0)
+ return WIFI_ERROR_INVALID_ARGS;
+
/*Temporary varibles to support the read complete length in chunks */
u8 *temp_host_dst;
u32 remainingLengthToBeRead, currentLength;