summaryrefslogtreecommitdiff
path: root/qcwcn
diff options
context:
space:
mode:
authorSubhani Shaik <subhanis@codeaurora.org>2016-03-10 14:52:54 +0530
committermukesh agrawal <quiche@google.com>2016-03-16 12:36:17 -0700
commitd66473247fe10bf2d1978e44c3f85be13dfb704e (patch)
tree98a0bc4eeb9aa248744e4217197261e7499d17ea /qcwcn
parente7565bd3953766d874f03973e732eeac290f3398 (diff)
downloadwlan-d66473247fe10bf2d1978e44c3f85be13dfb704e.tar.gz
Wifi-HAL: Extract wmsg length from nlmsg_hdr with ntohs()
Driver swaps the wmsg length based on endianness for ANI_NL_MSG_PUMAC messages. So, use ntohs() to get correct length of wmsg. The reason this swap is done in Wi-Fi HAL is to co work with the already existing tools that already does the same while operating with the host driver.
Diffstat (limited to 'qcwcn')
-rw-r--r--qcwcn/wifi_hal/wifilogger_diag.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/qcwcn/wifi_hal/wifilogger_diag.cpp b/qcwcn/wifi_hal/wifilogger_diag.cpp
index ac999ec..e3090e0 100644
--- a/qcwcn/wifi_hal/wifilogger_diag.cpp
+++ b/qcwcn/wifi_hal/wifilogger_diag.cpp
@@ -2051,8 +2051,9 @@ wifi_error diag_message_handler(hal_info *info, nl_msg *msg)
/* Check nlmsg_type also to avoid processing unintended msgs */
if (wnl->nlh.nlmsg_type == ANI_NL_MSG_PUMAC) {
if ((wnl->nlh.nlmsg_len <= sizeof(tAniNlHdr)) ||
- (wnl->nlh.nlmsg_len < (sizeof(tAniNlHdr) + wnl->wmsg.length))) {
- ALOGE("Received message with insufficent length: %d", wnl->nlh.nlmsg_len);
+ (wnl->nlh.nlmsg_len < (sizeof(tAniNlHdr) + ntohs(wnl->wmsg.length)))) {
+ ALOGE("Received UMAC message with insufficent length: %d",
+ wnl->nlh.nlmsg_len);
return WIFI_ERROR_UNKNOWN;
}
if (wnl->wmsg.type == ANI_NL_MSG_LOG_HOST_EVENT_LOG_TYPE) {
@@ -2124,7 +2125,8 @@ wifi_error diag_message_handler(hal_info *info, nl_msg *msg)
} else if (wnl->nlh.nlmsg_type == ANI_NL_MSG_LOG) {
if ((wnl->nlh.nlmsg_len <= sizeof(tAniNlHdr)) ||
(wnl->nlh.nlmsg_len < (sizeof(tAniNlHdr) + wnl->wmsg.length))) {
- ALOGE("Received message with insufficent length: %d", wnl->nlh.nlmsg_len);
+ ALOGE("Received LOG message with insufficent length: %d",
+ wnl->nlh.nlmsg_len);
return WIFI_ERROR_UNKNOWN;
}
if (wnl->wmsg.type == ANI_NL_MSG_LOG_HOST_PRINT_TYPE) {
@@ -2142,7 +2144,8 @@ wifi_error diag_message_handler(hal_info *info, nl_msg *msg)
if ((wnl->nlh.nlmsg_len <= NLMSG_HDRLEN + sizeof(fw_event_hdr_t)) ||
(wnl->nlh.nlmsg_len < (NLMSG_HDRLEN + sizeof(fw_event_hdr_t) +
event_hdr->length))) {
- ALOGE("Received message with insufficent length: %d", wnl->nlh.nlmsg_len);
+ ALOGE("Received CNSS_DIAG message with insufficent length: %d",
+ wnl->nlh.nlmsg_len);
return WIFI_ERROR_UNKNOWN;
}
diag_fw_type = event_hdr->diag_type;