diff --git a/include/wifi/hdf_wifi_event.h b/include/wifi/hdf_wifi_event.h index a1c68fc8fd0d5f5154733ba544813abacee34e4d..cfae47b1196f1caa733c350e92d162ee9052bc75 100644 --- a/include/wifi/hdf_wifi_event.h +++ b/include/wifi/hdf_wifi_event.h @@ -32,8 +32,8 @@ * @version 1.0 */ -#ifndef __HDF_WIFI_EVENT_H__ -#define __HDF_WIFI_EVENT_H__ +#ifndef HDF_WIFI_EVENT_H +#define HDF_WIFI_EVENT_H #include "hdf_wifi_cmd.h" #include "wifi_mac80211_ops.h" @@ -52,7 +52,7 @@ extern "C" { * @version 1.0 */ struct RateInfo { - uint8_t flags; /**< Flag field, used to indicate a specific rate transmission type of 802.11n */ + uint8_t flags; /**< Flag, used to indicate a specific rate transmission type of 802.11n */ uint8_t mcs; /**< Modulation and Coding Scheme (MCS) index of the HT/VHT/HE rate */ uint16_t legacy; /**< 100 kbit/s bit rate defined in 802.11a/b/g */ uint8_t nss; /**< Number of streams (for VHT and HE only) */ @@ -268,7 +268,7 @@ struct Ieee80211Mgmt { struct ScannedBssInfo { int32_t signal; /**< Signal strength */ int16_t freq; /**< Center frequency of the channel where the BSS is located */ - uint8_t arry[2]; /**< Reserved */ + uint8_t array[2]; /**< Reserved */ uint32_t mgmtLen; /**< Management frame length */ struct Ieee80211Mgmt *mgmt; /**< Start address of the management frame */ }; @@ -482,5 +482,5 @@ int32_t HdfWifiEventResetResult(const uint8_t chipId, int32_t resetStatus); #endif #endif -#endif /* __HDF_WIFI_EVENT_H__ */ +#endif /* HDF_WIFI_EVENT_H */ /** @} */ diff --git a/include/wifi/hdf_wifi_product.h b/include/wifi/hdf_wifi_product.h index 1007523cf545a181dea5527e7fef26f89b8fb656..40bf8842078c92b6ebeb64e13e0687d028cb43e3 100644 --- a/include/wifi/hdf_wifi_product.h +++ b/include/wifi/hdf_wifi_product.h @@ -113,7 +113,7 @@ struct WifiModule* HdfWlanGetModule(void); struct HdfWlanDevice *HdfWlanGetWlanDevice(uint8_t chipId); /** - * @brief Send broadcast event. + * @brief Sends a broadcast event. * * @param id Indicates the ID of the event to send. * @param data Indicates the pointer to the event information. diff --git a/include/wifi/net_device.h b/include/wifi/net_device.h index d13adb0fa06370714924f269e8a06505b343b7fc..9b1b5963422b43c009390b37597128e8a3a5867a 100644 --- a/include/wifi/net_device.h +++ b/include/wifi/net_device.h @@ -387,7 +387,7 @@ struct TcpHeader { uint16_t sPort; /**< Source port number */ uint16_t dPort; /**< Destination port number */ uint32_t seqNum; /**< Sequence number */ - uint32_t ackNum; /**< Acknowledgement number */ + uint32_t ackNum; /**< Acknowledgment number */ uint8_t offset; /**< Header length */ uint8_t flags; /**< Flags */ uint16_t window; /**< Window size */ @@ -465,7 +465,7 @@ typedef struct NetDevice { char name[IFNAMSIZ]; /**< Network device name {@link IFNAMSIZ} */ NetLinkType LinkLayerType; /**< Data link layer type */ IfType funType; /**< Network port type */ - char macAddr[MAC_ADDR_SIZE]; /**< MAC address {@link MAC_ADDR_SIZE} */ + unsigned char macAddr[MAC_ADDR_SIZE]; /**< MAC address {@link MAC_ADDR_SIZE} */ uint32_t flags; /**< Network port status */ uint32_t mtu; /**< Maximum transmission unit */ int32_t watchdogTime; /**< Watchdog duration */ @@ -496,12 +496,12 @@ struct NetDeviceInterFace { void (*deInit)(struct NetDevice *netDev); /**< Deinitializes a network device to be delete. */ int32_t (*open)(struct NetDevice *netDev); /**< Opens the data link layer. */ int32_t (*stop)(struct NetDevice *netDev); /**< Closes the data link layer. */ - NetDevTxResult (*xmit)(struct NetDevice *netDev, NetBuf *netBuff); /**< Sends data. */ + NetDevTxResult (*xmit)(struct NetDevice *netDev, NetBuf *netBuff); /**< Sends data. */ int32_t (*ioctl)(struct NetDevice *netDev, IfReq *req, int32_t cmd); /**< Used for the control command word. */ int32_t (*setMacAddr)(struct NetDevice *netDev, void *addr); /**< Sets the MAC address. */ struct NetDevStats *(*getStats)(struct NetDevice *netDev); /**< Obtains the statistics. */ void (*setNetIfStatus)(struct NetDevice *netDev, NetIfStatus status); /**< Sets the network port status. */ - uint16_t (*selectQueue)(struct NetDevice *netDev, NetBuf *netBuff);/**< Selects a priority queue. */ + uint16_t (*selectQueue)(struct NetDevice *netDev, NetBuf *netBuff); /**< Selects a priority queue. */ uint32_t (*netifNotify)(struct NetDevice *netDev, NetDevNotify *notify); /**< Notifies the network port status. */ int32_t (*changeMtu)(struct NetDevice *netDev, int32_t newMtu); /**< Changes the maximum number of * transmission units. @@ -658,7 +658,7 @@ int32_t NetIfSetAddr(const struct NetDevice *netDevice, const IpV4Addr *ipAddr, * @brief Notifies the network layer of the network port state. * * @param netDevice Indicates the pointer to the network device obtained during initialization. - * @paramstatus Indicates the network port state, as enumerated in {@link NetIfSatus}. + * @param status Indicates the network port state, as enumerated in {@link NetIfSatus}. * @param status Indicates the network port state, as enumerated in {@link NetIfSatus}. * * @return Returns 0 if the operation is successful; returns a non-zero value otherwise. diff --git a/include/wifi/wifi_inc.h b/include/wifi/wifi_inc.h index f1ec5336fc7e9072ccede0b4e618dd6d78102f23..5e25c080e28fac70a8aedc5dfd3665c4d1e34bac 100644 --- a/include/wifi/wifi_inc.h +++ b/include/wifi/wifi_inc.h @@ -62,7 +62,7 @@ struct BusDev; * @version 1.0 */ enum WifiMainFeatureType { - HDF_WIFI_FEATURE_AP, /**< AP */ + HDF_WIFI_FEATURE_AP, /**< Access point (AP) */ HDF_WIFI_FEATURE_STA, /**< Station */ HDF_WIFI_FEATURE_P2P, /**< Peer-to-peer (P2P) */ HDF_WIFI_FEATURE_NAN, /**< Neighbor Awareness Networking (NAN) */ diff --git a/include/wifi/wifi_mac80211_ops.h b/include/wifi/wifi_mac80211_ops.h index eb498f9111d147ef784903665dda8ef355f7e7ca..4e1244bfb85bbfd160ac30945607ffdc22486bce 100644 --- a/include/wifi/wifi_mac80211_ops.h +++ b/include/wifi/wifi_mac80211_ops.h @@ -32,8 +32,8 @@ * @version 1.0 */ -#ifndef _WIFI_MAC80211_OPS_H_ -#define _WIFI_MAC80211_OPS_H_ +#ifndef WIFI_MAC80211_OPS_H +#define WIFI_MAC80211_OPS_H #include "net_device.h" #include "hdf_wifi_cmd.h" @@ -440,9 +440,9 @@ struct WlanAPConf { struct WlanHwCapability { void (*Release)(struct WlanHwCapability *self); /**< Function for releasing the hardware capability */ struct WlanBand *bands[IEEE80211_NUM_BANDS]; /**< Frequency bands */ - uint16_t htCapability; /**< High-throughput (HT) capability */ - uint16_t supportedRateCount;/**< Number of supported rates */ - uint16_t *supportedRates; /**< An array of supported rates in 100 kbit/s */ + uint16_t htCapability; /**< High-throughput (HT) capability */ + uint16_t supportedRateCount; /**< Number of supported rates */ + uint16_t *supportedRates; /**< An array of supported rates in 100 kbit/s */ }; /** @@ -767,5 +767,5 @@ struct HdfMac80211APOps { int32_t (*GetAssociatedStasInfo)(NetDevice *netDev, WifiStaInfo *staInfo, uint32_t num); }; -#endif // _WIFI_MAC80211_OPS_H_ +#endif // WIFI_MAC80211_OPS_H /** @} */ diff --git a/include/wifi/wifi_module.h b/include/wifi/wifi_module.h index f58b04dd1235513bca83d4386120a76ec2f0b22c..6bb836c2da7979d00566dfba14bba3265fb39acc 100644 --- a/include/wifi/wifi_module.h +++ b/include/wifi/wifi_module.h @@ -206,7 +206,7 @@ int16_t InitWifiModule(struct WifiModule *module, const struct HdfConfigWlanModu #define RETURN_IF_CHIPOPS_NOT_IMPLEMENT(chipOps, opsName) \ do { \ - if ((chipOps) == NULL ||(chipOps)->opsName == NULL) { \ + if ((chipOps) == NULL || (chipOps)->opsName == NULL) { \ HDF_LOGE("macOps" #opsName "not implement"); \ return HDF_ERR_INVALID_OBJECT; \ } \ diff --git a/model/network/wifi/platform/src/qos/flow_control.c b/model/network/wifi/platform/src/qos/flow_control.c index 923598eb8ebf8219123b5a20f64891266c158939..b4963f5cd8310244a3ac2e95780f06541de376cc 100644 --- a/model/network/wifi/platform/src/qos/flow_control.c +++ b/model/network/wifi/platform/src/qos/flow_control.c @@ -101,7 +101,7 @@ static FlowControlQueueID IpProcessFunc(const void *buff, uint32_t len) return QUEUE_ID_COUNT; } if (len < sizeof(struct IpHeader)) { - HDF_LOGE("%s fail: len not right!", __func__); + HDF_LOGE("%s fail: IpHeader len not right!", __func__); return QUEUE_ID_COUNT; } ipHeader = (struct IpHeader *)buff; @@ -116,6 +116,10 @@ static FlowControlQueueID IpProcessFunc(const void *buff, uint32_t len) * ---------------------------------------------------------------------- */ id = TosToFcQueueId(ipHeader->tos >> IP_PRI_SHIFT); + if ((len - sizeof(struct IpHeader)) < sizeof(struct UdpHeader)) { + HDF_LOGE("%s fail: UdpHeader len not right!", __func__); + return QUEUE_ID_COUNT; + } udpHdr = (struct UdpHeader *)(ipHeader + 1); if (((ntohs(ipHeader->fragInfo) & 0x1FFF) == 0) && IsDhcpPort(udpHdr, len - sizeof(struct IpHeader))) { id = VIP_QUEUE_ID; @@ -381,7 +385,7 @@ void DeInitFlowControl(struct FlowControlModule *fcm) return; } - /* 1:Detroy task. 2:Destroy osalwait. 3:free NetBuff. */ + /* 1:Destroy task. 2:Destroy osalwait. 3:free NetBuff. */ DestroyFlowControlTask(fcm); for (i = 0; i < FLOW_DIR_COUNT; i++) { OsalSemDestroy(&fcm->sem[i]); diff --git a/model/sensor/driver/common/src/sensor_common.c b/model/sensor/driver/common/src/sensor_common.c index a48719f978f46a0398a696f0c3e58c3115241d0b..c7130f677d71c00e30b61c2636fe216d347d9765 100644 --- a/model/sensor/driver/common/src/sensor_common.c +++ b/model/sensor/driver/common/src/sensor_common.c @@ -160,4 +160,4 @@ void DestroySensorThread(struct OsalThread *thread, uint8_t *status) OsalThreadDestroy(thread); *status = SENSOR_THREAD_DESTROY; -} +} \ No newline at end of file diff --git a/model/sensor/driver/common/src/sensor_parser.c b/model/sensor/driver/common/src/sensor_parser.c index 0030fc487f703e10efdc76bab6469909b03945b7..57472baa5baa0930f932094c0fad82a6e6a47dcd 100644 --- a/model/sensor/driver/common/src/sensor_parser.c +++ b/model/sensor/driver/common/src/sensor_parser.c @@ -379,4 +379,4 @@ int32_t GetSensorBaseConfigData(const struct DeviceResourceNode *node, struct Se CHECK_PARSER_RESULT_RETURN_VALUE(ret, "accelAttr"); return HDF_SUCCESS; -} +} \ No newline at end of file diff --git a/support/posix/src/osal_thread.c b/support/posix/src/osal_thread.c index 4fcfce157f1e28979066ad3c470cb015f77956b3..12c162ff96d5e831994ed7576cf18c966cb6eb22 100644 --- a/support/posix/src/osal_thread.c +++ b/support/posix/src/osal_thread.c @@ -11,7 +11,6 @@ #include "hdf_base.h" #include "hdf_log.h" #include "osal_mem.h" - #ifndef PTHREAD_STACK_MIN #define OSAL_PTHREAD_STACK_MIN 4096 #else @@ -79,7 +78,7 @@ int32_t OsalThreadCreate(struct OsalThread *thread, OsalThreadEntry threadEntry, int32_t OsalThreadDestroy(struct OsalThread *thread) { - if (thread->realThread != NULL) { + if (thread != NULL && thread->realThread != NULL) { OsalMemFree(thread->realThread); thread->realThread = NULL; } diff --git a/test/unittest/ability/config/hcs_parser/unittest/hcs_config_test.c b/test/unittest/ability/config/hcs_parser/unittest/hcs_config_test.c index cb2ea0c128d98d62726e0ccba3ab9b63df0676d5..b5757268eb086b737cd18db685398a5e5a30aa3a 100644 --- a/test/unittest/ability/config/hcs_parser/unittest/hcs_config_test.c +++ b/test/unittest/ability/config/hcs_parser/unittest/hcs_config_test.c @@ -1019,4 +1019,4 @@ int HcsTestGetNodeAttrRefFail(void) return HDF_FAILURE; } return HDF_SUCCESS; -} +} \ No newline at end of file