From 203a5a7727a80ab519ea00181a909e415c5567ab Mon Sep 17 00:00:00 2001 From: Frank Wunderlich Date: Wed, 29 Aug 2018 19:17:00 +0200 Subject: [PATCH] [gcc] gcc8-fixes by Dominik Koch + nic_rx-patch from https://bugs.linaro.org/show_bug.cgi?id=3823 --- .../misc/mediatek/connectivity/wlan/gen2/nic/nic_rx.c | 10 ++++++---- .../misc/mediatek/connectivity/wlan/gen2/nic/que_mgt.c | 2 +- .../connectivity/wlan/gen2/os/linux/include/gl_kal.h | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/misc/mediatek/connectivity/wlan/gen2/nic/nic_rx.c b/drivers/misc/mediatek/connectivity/wlan/gen2/nic/nic_rx.c index ba4840414da85..65823023cec0e 100644 --- a/drivers/misc/mediatek/connectivity/wlan/gen2/nic/nic_rx.c +++ b/drivers/misc/mediatek/connectivity/wlan/gen2/nic/nic_rx.c @@ -2061,7 +2061,6 @@ VOID nicRxProcessEventPacket(IN P_ADAPTER_T prAdapter, IN OUT P_SW_RFB_T prSwRfb case EVENT_ID_BT_OVER_WIFI: #if CFG_ENABLE_BT_OVER_WIFI { - UINT_8 aucTmp[sizeof(AMPC_EVENT) + sizeof(BOW_LINK_DISCONNECTED)]; P_EVENT_BT_OVER_WIFI prEventBtOverWifi; P_AMPC_EVENT prBowEvent; P_BOW_LINK_CONNECTED prBowLinkConnected; @@ -2069,11 +2068,11 @@ VOID nicRxProcessEventPacket(IN P_ADAPTER_T prAdapter, IN OUT P_SW_RFB_T prSwRfb prEventBtOverWifi = (P_EVENT_BT_OVER_WIFI) (prEvent->aucBuffer); - /* construct event header */ - prBowEvent = (P_AMPC_EVENT) aucTmp; - if (prEventBtOverWifi->ucLinkStatus == 0) { /* Connection */ + UINT_8 aucTmp[sizeof(AMPC_EVENT) + sizeof(BOW_LINK_CONNECTED)]; + /* construct event header */ + prBowEvent = (P_AMPC_EVENT) aucTmp; prBowEvent->rHeader.ucEventId = BOW_EVENT_ID_LINK_CONNECTED; prBowEvent->rHeader.ucSeqNumber = 0; prBowEvent->rHeader.u2PayloadLength = sizeof(BOW_LINK_CONNECTED); @@ -2086,6 +2085,9 @@ VOID nicRxProcessEventPacket(IN P_ADAPTER_T prAdapter, IN OUT P_SW_RFB_T prSwRfb kalIndicateBOWEvent(prAdapter->prGlueInfo, prBowEvent); } else { /* Disconnection */ + UINT_8 aucTmp[sizeof(AMPC_EVENT) + sizeof(BOW_LINK_DISCONNECTED)]; + /* construct event header */ + prBowEvent = (P_AMPC_EVENT) aucTmp; prBowEvent->rHeader.ucEventId = BOW_EVENT_ID_LINK_DISCONNECTED; prBowEvent->rHeader.ucSeqNumber = 0; prBowEvent->rHeader.u2PayloadLength = sizeof(BOW_LINK_DISCONNECTED); diff --git a/drivers/misc/mediatek/connectivity/wlan/gen2/nic/que_mgt.c b/drivers/misc/mediatek/connectivity/wlan/gen2/nic/que_mgt.c index dd00859d46082..ad7107b1d9a44 100644 --- a/drivers/misc/mediatek/connectivity/wlan/gen2/nic/que_mgt.c +++ b/drivers/misc/mediatek/connectivity/wlan/gen2/nic/que_mgt.c @@ -5021,7 +5021,7 @@ VOID qmHandleRxArpPackets(P_ADAPTER_T prAdapter, P_SW_RFB_T prSwRfb) if (prBssInfo && prBssInfo->prStaRecOfAP && prBssInfo->prStaRecOfAP->aucMacAddr) { if (EQUAL_MAC_ADDR(&(pucData[ETH_TYPE_LEN_OFFSET + 10]), /* source hardware address */ prBssInfo->prStaRecOfAP->aucMacAddr)) { - strncpy(apIp, &(pucData[ETH_TYPE_LEN_OFFSET + 16]), sizeof(apIp)); /* src ip address */ + memcpy(apIp, &(pucData[ETH_TYPE_LEN_OFFSET + 16]), sizeof(apIp)); /* src ip address */ DBGLOG(INIT, TRACE, "get arp response from AP %d.%d.%d.%d\n", apIp[0], apIp[1], apIp[2], apIp[3]); } diff --git a/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/include/gl_kal.h b/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/include/gl_kal.h index 1406905095e64..b1386918c08de 100644 --- a/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/include/gl_kal.h +++ b/drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/include/gl_kal.h @@ -852,7 +852,7 @@ struct KAL_HALT_CTRL_T { /* string operation */ #define kalStrCpy(dest, src) strcpy(dest, src) -#define kalStrnCpy(dest, src, n) strncpy(dest, src, n) +#define kalStrnCpy(dest, src, n) memcpy(dest, src, n) #define kalStrCmp(ct, cs) strcmp(ct, cs) #define kalStrnCmp(ct, cs, n) strncmp(ct, cs, n) #define kalStrChr(s, c) strchr(s, c)